Return-Path: Delivered-To: apmail-incubator-esme-dev-archive@minotaur.apache.org Received: (qmail 74621 invoked from network); 22 Oct 2009 05:59:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 22 Oct 2009 05:59:50 -0000 Received: (qmail 47507 invoked by uid 500); 22 Oct 2009 05:59:50 -0000 Delivered-To: apmail-incubator-esme-dev-archive@incubator.apache.org Received: (qmail 47462 invoked by uid 500); 22 Oct 2009 05:59:49 -0000 Mailing-List: contact esme-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: esme-dev@incubator.apache.org Delivered-To: mailing list esme-dev@incubator.apache.org Received: (qmail 47451 invoked by uid 99); 22 Oct 2009 05:59:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Oct 2009 05:59:49 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of hirsch.dick@gmail.com designates 209.85.220.222 as permitted sender) Received: from [209.85.220.222] (HELO mail-fx0-f222.google.com) (209.85.220.222) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Oct 2009 05:59:47 +0000 Received: by fxm22 with SMTP id 22so8191327fxm.12 for ; Wed, 21 Oct 2009 22:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=QFN9ZuDL2bOHkGHxOdG8FZtwR7ECk2nimqNKRdUJ3jo=; b=WcF+51Cs46iE4xPInf2IUXCVqlDwkaq9RofzGAsXG9X90pUREt3CRGS8C1NT1kVPIX Ju6647itJwwMc3BrWD2+W8KPn13sRsaHPC1EBaR4HU2UAznkhRWjWzvhHNMZIZP9JS7X 6JvboCtBEXSZyggoVyoeeeKx77rmtHHxzn8bI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=or8rSby5nLDz+tK23k9FPWDvzVEOChrgMJjT2PAABfhjM6k91bUVdEkqdjAwCK285R K+YsgIosVqJzGJy4B441Mb+mXyODWD8VXI1u8EdKBkj07HRJCXQXtMBd5JjqBxLzgCvy Pkpc8UIh1Adxoj/YEbcTk7wrpGK215QFglpiI= MIME-Version: 1.0 Received: by 10.204.141.3 with SMTP id k3mr8899057bku.177.1256191165529; Wed, 21 Oct 2009 22:59:25 -0700 (PDT) In-Reply-To: <4db64d890910212110leee7247i4481920a4e937804@mail.gmail.com> References: <4db64d890910190830h677c0b18p9a62f8e4dae526b3@mail.gmail.com> <4db64d890910190832gb93cdfbmb57fd27747aa1e96@mail.gmail.com> <4db64d890910201750g4053080ft11c11f7e02bd424a@mail.gmail.com> <4db64d890910202143q41424240ta162f54634df4774@mail.gmail.com> <4db64d890910212110leee7247i4481920a4e937804@mail.gmail.com> Date: Thu, 22 Oct 2009 07:59:25 +0200 Message-ID: Subject: Re: ESME-87 - delete user from pool From: Richard Hirsch To: esme-dev@incubator.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 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: > =C2=A0 =C2=A0def deleteUserFromPool(in: Privilege) { > =C2=A0 =C2=A0 =C2=A0 //Delete current admin only if admin permissions by = other users exist > =C2=A0 =C2=A0if(!isValidate) > =C2=A0 =C2=A0 =C2=A0throw new Exception("No other admin users in pool!") > > =C2=A0 =C2=A0 =C2=A0val userId =3D in.user.is > =C2=A0 =C2=A0 =C2=A0in.delete_! > =C2=A0 =C2=A0 =C2=A0Distributor ! Distributor.RefreshUser(userId) > =C2=A0 =C2=A0} > > Server check whether this operation is validate or not, if not throw > exception. > > =C2=A0user if and S.error: > =C2=A0 =C2=A0def deleteUserFromPool(in: Privilege) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0if(isValidate =C2=A0) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0val userId =3D in.user.is > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0in.delete_! > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Distributor ! Distributor= .RefreshUser(userId) > =C2=A0 =C2=A0 =C2=A0 =C2=A0} else { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0S.error("No other admin u= sers in pool!") > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > > > > > > On Wed, Oct 21, 2009 at 9:07 PM, David Pollak > wrote: > >> On Tue, Oct 20, 2009 at 9:43 PM, Xuefeng Wu 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 > > >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 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 >> 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 >> > > wrote: >> > > >> > >> > > >> >> I think maybe it's better that we wrap the Exception after err= or >> > > 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) =C2=A0but I added a comment a= bout >> > > deleting >> > > >> >>> the last admin user. >> > > >> >>> >> > > >> >>> D. >> > > >> >>> >> > > >> >> >> > > >> >> >> > > >> >> >> > > >> >> -- >> > > >> >> Scala=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: =C2=A0http://groups= .google.com/group/scalacn >> > > >> >> >> > > >> > >> > > >> > >> > > >> > >> > > >> > -- >> > > >> > Scala=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: =C2=A0http://groups.= google.com/group/scalacn >> > > >> > >> > > >> >> > > > >> > > > >> > > > >> > > > -- >> > > > Scala=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: =C2=A0http://groups.goo= gle.com/group/scalacn >> > > > >> > > >> > >> > >> > >> > -- >> > Scala=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: =C2=A0http://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=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: =C2=A0http://groups.google.com= /group/scalacn >