Return-Path: Delivered-To: apmail-incubator-esme-dev-archive@minotaur.apache.org Received: (qmail 52510 invoked from network); 24 Oct 2009 12:19:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Oct 2009 12:19:55 -0000 Received: (qmail 80915 invoked by uid 500); 24 Oct 2009 12:19:55 -0000 Delivered-To: apmail-incubator-esme-dev-archive@incubator.apache.org Received: (qmail 80867 invoked by uid 500); 24 Oct 2009 12:19:55 -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 80850 invoked by uid 99); 24 Oct 2009 12:19:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Oct 2009 12:19:55 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of benewu@gmail.com designates 209.85.210.174 as permitted sender) Received: from [209.85.210.174] (HELO mail-yx0-f174.google.com) (209.85.210.174) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 24 Oct 2009 12:19:43 +0000 Received: by yxe4 with SMTP id 4so7996929yxe.32 for ; Sat, 24 Oct 2009 05:19:22 -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; bh=203Yf7A6enxfFsrWh2z9Qw6tdr1txFoZgUphsqcKpVw=; b=SIXw9XRINhpM/utl1X2cznOeKPGhH7M7aPx6V2j5963UpvJSDYFfBaQJ1kK9erHRra sc1xX/xAFNUpaQCHOrNFSdDiN76oDh+SLEwCfFpAjw7PDfFaWe4gigB30M8bvMhnJSzd rxYz3PuGUOYJbJ21cv4Bm/uWAa4mdpnuFrp6o= 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; b=FhCLv3LgRIgQWmo7uTXnR/jZoNagE3H7os6N9ZiAF80xTrZwyXQsX0TUHwsixvZLiO vnkgocBxSk9Q99/3yBUGcY7k6D9wPsCqFu6JyCs/zipgUq6xeRzpzUtCKvo3E74Ee8XN h7W+zjYOcKPQX2eBikZOPEEu48BJpSMixAFNc= MIME-Version: 1.0 Received: by 10.101.29.8 with SMTP id g8mr2468740anj.198.1256386761241; Sat, 24 Oct 2009 05:19:21 -0700 (PDT) In-Reply-To: <4db64d890910232303vb000250t39aa0c375b47456f@mail.gmail.com> References: <4db64d890910201750g4053080ft11c11f7e02bd424a@mail.gmail.com> <4db64d890910202143q41424240ta162f54634df4774@mail.gmail.com> <4db64d890910212110leee7247i4481920a4e937804@mail.gmail.com> <4db64d890910232303vb000250t39aa0c375b47456f@mail.gmail.com> Date: Sat, 24 Oct 2009 20:19:21 +0800 Message-ID: <4db64d890910240519u52efbac9gee84ceae58146395@mail.gmail.com> Subject: Re: ESME-87 - delete user from pool From: Xuefeng Wu To: esme-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=001636b2b05e9ab6940476ad564d X-Virus-Checked: Checked by ClamAV on apache.org --001636b2b05e9ab6940476ad564d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable @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 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 tha= t >> 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 t= he >> system fails (e.g., the RDBMS goes down). >> >> On Wed, Oct 21, 2009 at 10:59 PM, Richard Hirsch > >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 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 user= s >> > exist >> > > if(!isValidate) >> > > throw new Exception("No other admin users in pool!") >> > > >> > > val userId =3D 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 =3D 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 >> 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 >> > 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/sh= e >> 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 afte= r >> > 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=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: http://groups= .google.com/group/scalacn >> > >> > > >> >> >> > >> > > >> > >> > >> > > >> > >> > >> > > >> > >> > >> > > >> > -- >> > >> > > >> > Scala=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: http://groups.= google.com/group/scalacn >> > >> > > >> > >> > >> > > >> >> > >> > > > >> > >> > > > >> > >> > > > >> > >> > > > -- >> > >> > > > Scala=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: http://groups.goo= gle.com/group/scalacn >> > >> > > > >> > >> > > >> > >> > >> > >> > >> > >> > >> > >> > -- >> > >> > Scala=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: 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=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: 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=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: http://groups.google.com/grou= p/scalacn > --=20 Scala=E4=B8=AD=E6=96=87=E7=A4=BE=E5=8C=BA: http://groups.google.com/group/= scalacn --001636b2b05e9ab6940476ad564d--