Foren
How to clone/copy permissions of a role?
Hubert Felber, geändert vor 13 Jahren.
How to clone/copy permissions of a role?
Regular Member Beiträge: 157 Beitrittsdatum: 23.11.09 Neueste 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
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, geändert vor 13 Jahren.
RE: How to clone/copy permissions of a role?
Liferay Master Beiträge: 598 Beitrittsdatum: 22.10.07 Neueste BeiträgeHubert 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, geändert vor 13 Jahren.
RE: How to clone/copy permissions of a role?
Regular Member Beiträge: 157 Beitrittsdatum: 23.11.09 Neueste Beiträge
Thank you Minhchau
meera prince, geändert vor 11 Jahren.
RE: How to clone/copy permissions of a role?
Liferay Legend Beiträge: 1111 Beitrittsdatum: 08.02.11 Neueste 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));
}
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 azaruddin, geändert vor 10 Jahren.
RE: How to clone/copy permissions of a role?
Expert Beiträge: 492 Beitrittsdatum: 17.09.12 Neueste Beiträge
Hi prince
It seems that method is not available..I am working liferay 6.1
It seems that method is not available..I am working liferay 6.1