public final class SetupPermissions extends Object
| Modifier and Type | Field and Description |
|---|---|
static String[] |
PERMISSION_RO |
static String[] |
PERMISSION_RW |
| Modifier and Type | Method and Description |
|---|---|
static void |
addPermission(String roleName,
String name,
String primaryKey,
int scope,
String[] permission,
long companyId) |
static void |
addPermission(String roleName,
String className,
String primaryKey,
String[] permission,
long companyId) |
static void |
addPermissionToPage(eu.lundegaard.liferay.db.setup.domain.Role role,
String primaryKey,
String[] actionKeys,
long companyId) |
static void |
addReadRight(String roleName,
String className,
String primaryKey,
long companyId) |
static void |
addReadWrightRight(String roleName,
String className,
String primaryKey,
long companyId) |
static void |
clearPagePermissions(String primaryKey,
long companyId) |
static void |
removePermission(long companyId,
String name,
String primKey) |
static void |
setupPortletPermissions(eu.lundegaard.liferay.db.setup.domain.PortletPermissions portletPermissions,
long companyId)
Sets up permissions for a PortletPermissions object.
|
static void |
updatePermission(String locationHint,
long groupId,
long companyId,
long elementId,
Class clazz,
eu.lundegaard.liferay.db.setup.domain.RolePermissions rolePermissions,
HashMap<String,List<String>> defaultPermissions) |
static void |
updatePermission(String locationHint,
long groupId,
long companyId,
long elementId,
String className,
eu.lundegaard.liferay.db.setup.domain.RolePermissions rolePermissions,
HashMap<String,List<String>> defaultPermissions)
Update permissions for an element of a given class.
|
public static final String[] PERMISSION_RO
public static final String[] PERMISSION_RW
public static void setupPortletPermissions(eu.lundegaard.liferay.db.setup.domain.PortletPermissions portletPermissions,
long companyId)
portletPermissions - The PortletPermissions object to set up permissions
for.companyId - The ID of the company for which to set up permissions.public static void addReadRight(String roleName, String className, String primaryKey, long companyId) throws com.liferay.portal.kernel.exception.SystemException, com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.SystemExceptioncom.liferay.portal.kernel.exception.PortalExceptionpublic static void addReadWrightRight(String roleName, String className, String primaryKey, long companyId) throws com.liferay.portal.kernel.exception.SystemException, com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.SystemExceptioncom.liferay.portal.kernel.exception.PortalExceptionpublic static void removePermission(long companyId,
String name,
String primKey)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
com.liferay.portal.kernel.exception.PortalExceptioncom.liferay.portal.kernel.exception.SystemExceptionpublic static void addPermission(String roleName, String name, String primaryKey, int scope, String[] permission, long companyId) throws com.liferay.portal.kernel.exception.SystemException, com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.SystemExceptioncom.liferay.portal.kernel.exception.PortalExceptionpublic static void addPermission(String roleName, String className, String primaryKey, String[] permission, long companyId) throws com.liferay.portal.kernel.exception.SystemException, com.liferay.portal.kernel.exception.PortalException
com.liferay.portal.kernel.exception.SystemExceptioncom.liferay.portal.kernel.exception.PortalExceptionpublic static void addPermissionToPage(eu.lundegaard.liferay.db.setup.domain.Role role,
String primaryKey,
String[] actionKeys,
long companyId)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException
com.liferay.portal.kernel.exception.PortalExceptioncom.liferay.portal.kernel.exception.SystemExceptionpublic static void clearPagePermissions(String primaryKey, long companyId) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException
com.liferay.portal.kernel.exception.PortalExceptioncom.liferay.portal.kernel.exception.SystemExceptionpublic static void updatePermission(String locationHint, long groupId, long companyId, long elementId, Class clazz, eu.lundegaard.liferay.db.setup.domain.RolePermissions rolePermissions, HashMap<String,List<String>> defaultPermissions)
public static void updatePermission(String locationHint, long groupId, long companyId, long elementId, String className, eu.lundegaard.liferay.db.setup.domain.RolePermissions rolePermissions, HashMap<String,List<String>> defaultPermissions)
This method updates the permissions for an element of a given class. If the rolePermissions parameter is not null, it will be used to set the permissions for the element. The rolePermissions parameter should be an object containing information about the roles and actions that should have permissions for the element. If the rolePermissions is null or the rolePermissions object does not contain any rolePermission, the defaultPermissions map will be used to set the permissions. The method uses a SetupPermissions helper class to add and remove permissions. If any exceptions are thrown while setting the permissions, they will be logged using the logger and the method will continue with the next role.
locationHint - A hint about the location of the element (used for
logging)groupId - The ID of the group the element belongs tocompanyId - The ID of the company the element belongs toelementId - The ID of the elementclassName - The fully-qualified class name of the elementrolePermissions - The role-based permissions to set for the element, or
null to use default permissionsdefaultPermissions - A map of default permissions, where the keys are
role names and the values are lists of action namesCopyright © 2016–2023 Lundegaard a.s.. All rights reserved.