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 <[email protected]
> wrote:
> On Tue, Oct 20, 2009 at 9:43 PM, Xuefeng Wu <[email protected]> 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 <[email protected]
> > >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 <[email protected]> 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 <
> > [email protected]
> > > >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 <[email protected]>
> 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 <[email protected]>
> > > 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 <
> > > [email protected]
> > > >> >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