--- On Thu, 8/26/10, David Sean Taylor <d.tay...@onehippo.com> wrote:
> From: David Sean Taylor <d.tay...@onehippo.com> > Subject: Re: Jetspeed2(2.0.1) custom user > To: "Jetspeed Users List" <jetspeed-user@portals.apache.org> > Date: Thursday, August 26, 2010, 7:29 AM > On Wed, Aug 25, 2010 at 12:25 AM, > Calin Avasilcai <calin...@gmail.com> > wrote: > > I need to be able to mark a jetspeed user as > "special", and prevent an admin > > to delete this user. > > > > My idea was to add a binary column in > security_principal table and use the > > information in this column in user-details.jsp from > j2-admin portlet > > application, in order to decide to show or not the > delete button.But it > > seams this is not that simple as I thought it would > be. > > > > First of all, is this approach a good one, or is there > a simpler solution? > > And if this is the way to go, how can I pass the > special flag in the jsp? > > > > > Which version are you using? There are no JSPs in the 2.2 > User > Manager, its Wicket. I think this could be configured with > something > like: > > > #if (!portletRequest.isUserInRole("admin")) > > <input type="submit" wicket:id="remove" > /> > > #end > > or even turned into a generalized feature... > > Of course the above example won't work in Wicket. Actually > I think you > need a conditional component. I dont use Wicket myself, so > I'd have to > dig to get you an answer. Be better if some Wicket guru > popped up with > a wise answer ... :) IMHO, if you want to modify the Wicket code, please have a look at this source: http://svn.apache.org/repos/asf/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java Especially, from line# 347-365. There the remove button of the user management panel is added. So, for example, I think you can add the following to check if the user is in "Special" role or not. (You can follow the Ron's great idea by assigning "Special" role.) If the user is in "Special" role, then you could hide the button: try { RoleManager roleManager = ((AbstractAdminWebApplication)getApplication()).getServiceLocator().getRoleManager(); if (roleManager.isUserInRole(principal.getName(), "Special")) { profileForm.get("remove").setVisibilityAllowed(true).setVisible(false); } } catch (SecurityException se) { se.printStackTrace(); } HTH, Woonsan > > IMO seems it would be lots easier for an portal integration > framework > to use something a little more mainstream like JSP or vm, > but what do > i know > > --------------------------------------------------------------------- > To unsubscribe, e-mail: jetspeed-user-unsubscr...@portals.apache.org > For additional commands, e-mail: jetspeed-user-h...@portals.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: jetspeed-user-unsubscr...@portals.apache.org For additional commands, e-mail: jetspeed-user-h...@portals.apache.org