Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Hubert Felber
How to clone/copy permissions of a role?
8 febbraio 2011 8.10
Risposta

Hubert Felber

Punteggio: Regular Member

Messaggi: 157

Data di Iscrizione: 23 novembre 2009

Messaggi recenti

Hello,

We import Roles from LDAP to Liferay (PortalLdapImporterImpl). In our system we have a "quasi Administrator" role, which should be able to administrate the liferay Portal.

I could elevate persons in that role to Liferay Administrator role, but I don't want to do that. Instead I want to create a new role with initially the same permissions as the Liferay Administrator role.

How can I extract (make a copy) permissions out of a role and assign it to a new created role?

Thank you
Hubert
Minhchau Dang
RE: How to clone/copy permissions of a role?
9 febbraio 2011 20.50
Risposta

Minhchau Dang

LIFERAY STAFF

Punteggio: Expert

Messaggi: 349

Data di Iscrizione: 22 ottobre 2007

Messaggi recenti

Hubert Felber:
How can I extract (make a copy) permissions out of a role and assign it to a new created role?

Ordinarily, you would copy all the entries in the Roles_Permissions table and just change the roleId.

However, the administrator role is a special role that is handled in the permission checker and therefore (usually) has no entries in that table. Therefore, your only real way to do it would be to create a new permission checker that recognizes your new quasi-administrator role for what it is able to do.
Hubert Felber
RE: How to clone/copy permissions of a role?
9 febbraio 2011 23.51
Risposta

Hubert Felber

Punteggio: Regular Member

Messaggi: 157

Data di Iscrizione: 23 novembre 2009

Messaggi recenti

Thank you Minhchau
Meera Prince
RE: How to clone/copy permissions of a role?
24 gennaio 2013 23.07
Risposta

Meera Prince

Punteggio: Liferay Legend

Messaggi: 1110

Data di Iscrizione: 8 febbraio 2011

Messaggi recenti

java.util.List<com.liferay.portal.model.ResourcePermission> resourcePermissionList= ResourcePermissionLocalServiceUtil. getRoleResourcePermissions(
long roleId);
Use above method and pass role and get all ResourcePermission objects.
for(int i=0;i< resourcePermissionList.size();i++){
ResourcePermissionLocalServiceUtil. addResourcePermission (
resourcePermissionList.get(i).setRoleId(newRoleId));
}
Mohammad Azharuddin
RE: How to clone/copy permissions of a role?
14 aprile 2014 4.28
Risposta

Mohammad Azharuddin

Punteggio: Expert

Messaggi: 471

Data di Iscrizione: 17 settembre 2012

Messaggi recenti

Hi prince


It seems that method is not available..I am working liferay 6.1