Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Hubert Felber
How to clone/copy permissions of a role?
8. Februar 2011 08:10
Antwort

Hubert Felber

Rang: Regular Member

Nachrichten: 157

Eintrittsdatum: 23. November 2009

Neue Beiträge

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. Februar 2011 20:50
Antwort

Minhchau Dang

LIFERAY STAFF

Rang: Expert

Nachrichten: 349

Eintrittsdatum: 22. Oktober 2007

Neue Beiträge

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. Februar 2011 23:51
Antwort

Hubert Felber

Rang: Regular Member

Nachrichten: 157

Eintrittsdatum: 23. November 2009

Neue Beiträge

Thank you Minhchau
Meera Prince
RE: How to clone/copy permissions of a role?
24. Januar 2013 23:07
Antwort

Meera Prince

Rang: Liferay Legend

Nachrichten: 1110

Eintrittsdatum: 8. Februar 2011

Neue Beiträge

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. April 2014 04:28
Antwort

Mohammad Azharuddin

Rang: Expert

Nachrichten: 475

Eintrittsdatum: 17. September 2012

Neue Beiträge

Hi prince


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