esme-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Hirsch <hirsch.d...@gmail.com>
Subject Re: ESME-87 - delete user from pool
Date Tue, 27 Oct 2009 07:43:58 GMT
This patch is committed and deployed on stax.

Thanks.

D.

On Sat, Oct 24, 2009 at 1:19 PM, Xuefeng Wu <benewu@gmail.com> wrote:
> @D
> I added the patch 'AccessPoolMgr.scala' for this.
> The delete link will not show if only admin left.
>
> On Sat, Oct 24, 2009 at 2:03 PM, Xuefeng Wu <benewu@gmail.com> wrote:
>
>> Good answer, I will modify.
>>
>>
>> On Sat, Oct 24, 2009 at 4:40 AM, David Pollak <
>> feeder.of.the.bears@gmail.com> wrote:
>>
>>> In general, if we can determine that the state of the system is such that
>>> going to a link will cause an exception, we should put a guard (an If())
>>> around that link.
>>>
>>> In general one should avoid code writing that throws exceptions.  In
>>> Scala,
>>> using Option/Box allows you to conveniently wrap results that may or may
>>> not
>>> be calculable.  Exceptions should only happen if something external to the
>>> system fails (e.g., the RDBMS goes down).
>>>
>>> On Wed, Oct 21, 2009 at 10:59 PM, Richard Hirsch <hirsch.dick@gmail.com
>>> >wrote:
>>>
>>> > If we remove the link, the user won't have to get an exception which
>>> > saves time and hassle.
>>> >
>>> > We could also send a notice message that the user can't be deleted,
>>> > because it is the last admin user.
>>> >
>>> > D.
>>> >
>>> > On Thu, Oct 22, 2009 at 6:10 AM, Xuefeng Wu <benewu@gmail.com> wrote:
>>> > > For example, in this case, users can not the last admin from pool,
>>> it's
>>> > > business logic.
>>> > > I think there're three ways:
>>> > > 1. disable/hide menu(link)
>>> > > We could check whether the function should be validate or not, and
>>> could
>>> > > disable/hide it.
>>> > >
>>> > > 2. determine by 'if' or 'case' in Scala
>>> > > and Lift provide S.error(msg)
>>> > >
>>> > > But some times it's not nature.
>>> > >
>>> > > 3. use exception when user do something wrong.
>>> > >
>>> > > I think the best way is exception when there's something wrong.
>>> > > Exception could provide more information for Users and Developer.
>>> > > And exception is more nature for programming.
>>> > >
>>> > > for example:
>>> > > User exception:
>>> > >    def deleteUserFromPool(in: Privilege) {
>>> > >       //Delete current admin only if admin permissions by other
users
>>> > exist
>>> > >    if(!isValidate)
>>> > >      throw new Exception("No other admin users in pool!")
>>> > >
>>> > >      val userId = in.user.is
>>> > >      in.delete_!
>>> > >      Distributor ! Distributor.RefreshUser(userId)
>>> > >    }
>>> > >
>>> > > Server check whether this operation is validate or not, if not throw
>>> > > exception.
>>> > >
>>> > >  user if and S.error:
>>> > >    def deleteUserFromPool(in: Privilege) {
>>> > >        if(isValidate  ) {
>>> > >              val userId = in.user.is
>>> > >              in.delete_!
>>> > >              Distributor ! Distributor.RefreshUser(userId)
>>> > >        } else {
>>> > >              S.error("No other admin users in pool!")
>>> > >        }
>>> > >
>>> > >
>>> > >
>>> > >
>>> > >
>>> > > On Wed, Oct 21, 2009 at 9:07 PM, David Pollak <
>>> > feeder.of.the.bears@gmail.com
>>> > >> wrote:
>>> > >
>>> > >> On Tue, Oct 20, 2009 at 9:43 PM, Xuefeng Wu <benewu@gmail.com>
>>> wrote:
>>> > >>
>>> > >> > It's a pleasure.
>>> > >> > @David,
>>> > >> > Could Lift wrap business exception and show as notice or warning
>>> for
>>> > >> users?
>>> > >> >
>>> > >>
>>> > >> Sure... in what context?
>>> > >>
>>> > >>
>>> > >> >
>>> > >> >
>>> > >> > On Wed, Oct 21, 2009 at 10:48 AM, Richard Hirsch <
>>> > hirsch.dick@gmail.com
>>> > >> > >wrote:
>>> > >> >
>>> > >> > > OK - why don't we leave it.
>>> > >> > >
>>> > >> > > Do you want to take another Jira item? What about ESME-101
>>> > >> > > (https://issues.apache.org/jira/browse/ESME-101)?
>>> > >> > >
>>> > >> > > D.
>>> > >> > >
>>> > >> > > On Wed, Oct 21, 2009 at 2:50 AM, Xuefeng Wu <benewu@gmail.com>
>>> > wrote:
>>> > >> > > > Yes, It's easier. But most of time user will not
delete the
>>> last
>>> > >> admin,
>>> > >> > > but
>>> > >> > > > we always check this, it would wast most computer
resource.
>>> > >> > > >
>>> > >> > > > On Tue, Oct 20, 2009 at 12:53 AM, Richard Hirsch
<
>>> > >> > hirsch.dick@gmail.com
>>> > >> > > >wrote:
>>> > >> > > >
>>> > >> > > >> wouldn't it be easier to just remove the "delete"
link when
>>> there
>>> > is
>>> > >> > > >> only one admin left?
>>> > >> > > >>
>>> > >> > > >> On Mon, Oct 19, 2009 at 5:32 PM, Xuefeng Wu
<benewu@gmail.com
>>> >
>>> > >> wrote:
>>> > >> > > >> > I mean that give user a kindly warning
message after he/she
>>> do
>>> > >> wrong
>>> > >> > > >> better
>>> > >> > > >> > than disable the function.
>>> > >> > > >> >
>>> > >> > > >> >
>>> > >> > > >> > On Mon, Oct 19, 2009 at 11:30 PM, Xuefeng
Wu <
>>> benewu@gmail.com
>>> > >
>>> > >> > > wrote:
>>> > >> > > >> >
>>> > >> > > >> >> I think maybe it's better that we wrap
the Exception after
>>> > error
>>> > >> > > cause,
>>> > >> > > >> but
>>> > >> > > >> >> not always check before user do.
>>> > >> > > >> >>
>>> > >> > > >> >>
>>> > >> > > >> >> On Mon, Oct 19, 2009 at 5:37 PM, Richard
Hirsch <
>>> > >> > > hirsch.dick@gmail.com
>>> > >> > > >> >wrote:
>>> > >> > > >> >>
>>> > >> > > >> >>> I committed everything (thanks)
 but I added a comment
>>> about
>>> > >> > > deleting
>>> > >> > > >> >>> the last admin user.
>>> > >> > > >> >>>
>>> > >> > > >> >>> D.
>>> > >> > > >> >>>
>>> > >> > > >> >>
>>> > >> > > >> >>
>>> > >> > > >> >>
>>> > >> > > >> >> --
>>> > >> > > >> >> Scala中文社区:  http://groups.google.com/group/scalacn
>>> > >> > > >> >>
>>> > >> > > >> >
>>> > >> > > >> >
>>> > >> > > >> >
>>> > >> > > >> > --
>>> > >> > > >> > Scala中文社区:  http://groups.google.com/group/scalacn
>>> > >> > > >> >
>>> > >> > > >>
>>> > >> > > >
>>> > >> > > >
>>> > >> > > >
>>> > >> > > > --
>>> > >> > > > Scala中文社区:  http://groups.google.com/group/scalacn
>>> > >> > > >
>>> > >> > >
>>> > >> >
>>> > >> >
>>> > >> >
>>> > >> > --
>>> > >> > Scala中文社区:  http://groups.google.com/group/scalacn
>>> > >> >
>>> > >>
>>> > >>
>>> > >>
>>> > >> --
>>> > >> Lift, the simply functional web framework http://liftweb.net
>>> > >> Beginning Scala http://www.apress.com/book/view/1430219890
>>> > >> Follow me: http://twitter.com/dpp
>>> > >> Surf the harmonics
>>> > >>
>>> > >
>>> > >
>>> > >
>>> > > --
>>> > > Scala中文社区:  http://groups.google.com/group/scalacn
>>> > >
>>> >
>>>
>>>
>>>
>>> --
>>> Lift, the simply functional web framework http://liftweb.net
>>> Beginning Scala http://www.apress.com/book/view/1430219890
>>> Follow me: http://twitter.com/dpp
>>> Surf the harmonics
>>>
>>
>>
>>
>> --
>> Scala中文社区:  http://groups.google.com/group/scalacn
>>
>
>
>
> --
> Scala中文社区:  http://groups.google.com/group/scalacn
>

Mime
View raw message