You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by "McDonnell, David" <Da...@csu.edu.au> on 2001/02/12 04:04:36 UTC

Security.checkPermission

Hi all,

Is Security.checkPermission() the only method to check for a permission?? I
want to check for permissions on objects, but I would like something a
little more "light-weight". 

The checkPermission function throws an exception in the case that the role
is not permitted. Is there a function that will return true/false but
performs the same action? My main reasoning for this is I want to
conditionally display a management option to the user, like "Click here to
modify permissions" in the case that the user has the permissions to do so,
and having an exception allocated and thrown for each Node and each user
seems like overkill.

Cheers,
Dave

Re: Security.checkPermission

Posted by Remy Maucherat <re...@apache.org>.
> Hi all,
>
> Is Security.checkPermission() the only method to check for a permission??
I
> want to check for permissions on objects, but I would like something a
> little more "light-weight".
>
> The checkPermission function throws an exception in the case that the role
> is not permitted. Is there a function that will return true/false but
> performs the same action? My main reasoning for this is I want to
> conditionally display a management option to the user, like "Click here to
> modify permissions" in the case that the user has the permissions to do
so,
> and having an exception allocated and thrown for each Node and each user
> seems like overkill.

Good idea. I've added a new Security.hasPermission method which does the
same as checkPermission, but returns a boolean instead of throwing an
exception.

Remy