That would work if I knew exactly what role the user must have. I want
that to be decided by the API, meaning, I want to check whether this
user has permissions to execute the updatePageSecurity method.

The only reason I ask this is because there is an unchecked exception
being thrown, which means this is supposed to be validated beforehand.

Thanks

Ruben Carvalho
Fidelity Investments Ireland
Parkmore East Business Park, Galway - Ireland
Contacts:
*       Internal        8 737 7414
*       External        +353 (0)91 747414
*       Email   [email protected]

Any comments or statements made in this email are not necessarily those
of the Fidelity Technology Group, Enterprise Solutions, or any of the
Fidelity Investments group companies. The information transmitted is
intended only for the person or entity to which it is addressed and may
contain confidential and/or privileged material. If you have received
this in error, please contact the sender and delete the material from
any computer. All e-mails sent from or to Fidelity Investments may be
subject to our monitoring procedures.

-----Original Message-----
From: Jeroen Hoffman [mailto:[email protected]] 
Sent: 06 February 2009 15:24
To: Jetspeed Users List
Subject: Re: Check user permissions

Hi,

Perhaps you're looking for the method RoleManager.isUserInRole(username,

roleFullPathName)?

The role manager can be found similarly to the page manager, with 
CPS_ROLE_MANAGER_COMPONENT.

Jeroen


Carvalho, Ruben wrote:
> I am trying to change the portlet security on some portlets by
creating
> a new security constraint definition and associating it with a portlet
> definition.
> 
> The updatePageSecurity method (*** below) throws the unchecked
exception
> SecurityException. I assume the reason for this is to force the code
to
> first check if a user has "admin" permissions.
> 
> My question is how can I validate that the user trying to set this
> security constraint has permission to do it beforehand?
> 
> This is the code I have, exception thrown on ***
> 
> PageManager pageManager = (PageManager)
>
portletContext.getAttribute(CommonPortletServices.CPS_PAGE_MANAGER_COMPO
> NENT);
> 
> PageSecurity pageSecurity = pageManager.getPageSecurity();
> 
> SecurityConstraintsDef def = pageManager.newSecurityConstraintsDef();
> 
> (set some attributes in def like constraint name, roles, permissions)
> 
> pageSecurity.getSecurityConstraintsDefs().add(def);
> 
>
pageSecurity.setSecurityConstraintsDefs(pageSecurity.getSecurityConstrai
> ntsDefs());
> 
> *** pageManager.updatePageSecurity(pageSecurity); ***
> 
> (get the portlet definition and call setJetspeedSecurityConstraint
with
> the constraint name from above)
> 
> Thanks.
> Ruben Carvalho
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to