Class EntityPermissionChecker
- java.lang.Object
-
- org.apache.ofbiz.entityext.permission.EntityPermissionChecker
-
public class EntityPermissionChecker extends java.lang.Object
EntityPermissionChecker Class Services for granting operation permissions on Content entities in a data-driven manner.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
EntityPermissionChecker.AuxiliaryValueGetter
static interface
EntityPermissionChecker.PermissionConditionGetter
static interface
EntityPermissionChecker.RelatedRoleGetter
static class
EntityPermissionChecker.StdAuxiliaryValueGetter
static class
EntityPermissionChecker.StdPermissionConditionGetter
static class
EntityPermissionChecker.StdRelatedRoleGetter
-
Field Summary
Fields Modifier and Type Field Description protected EntityPermissionChecker.AuxiliaryValueGetter
auxiliaryValueGetter
protected boolean
displayFailCond
protected FlexibleStringExpander
entityIdExdr
protected FlexibleStringExpander
entityNameExdr
static java.lang.String
module
protected EntityPermissionChecker.PermissionConditionGetter
permissionConditionGetter
protected EntityPermissionChecker.RelatedRoleGetter
relatedRoleGetter
protected java.util.List<java.lang.String>
targetOperationList
-
Constructor Summary
Constructors Constructor Description EntityPermissionChecker(org.w3c.dom.Element element)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
checkHasRoleOperations(java.lang.String partyId, java.util.List<java.lang.String> targetOperations, Delegator delegator)
static boolean
checkHasRoleOperations(java.lang.String partyId, EntityPermissionChecker.PermissionConditionGetter permissionConditionGetter, Delegator delegator)
static java.util.Map<java.lang.String,java.lang.Object>
checkPermission(GenericValue content, java.lang.String statusId, GenericValue userLogin, java.util.List<java.lang.String> passedPurposes, java.util.List<java.lang.String> targetOperations, java.util.List<java.lang.String> passedRoles, Delegator delegator, Security security, java.lang.String entityAction)
static java.util.Map<java.lang.String,java.lang.Object>
checkPermission(GenericValue content, java.lang.String statusId, GenericValue userLogin, java.util.List<java.lang.String> passedPurposes, java.util.List<java.lang.String> targetOperations, java.util.List<java.lang.String> passedRoles, Delegator delegator, Security security, java.lang.String entityAction, java.lang.String privilegeEnumId, java.lang.String quickCheckContentId)
static java.util.Map<java.lang.String,java.lang.Object>
checkPermission(GenericValue content, java.util.List<java.lang.String> statusList, GenericValue userLogin, java.util.List<java.lang.String> passedPurposes, java.util.List<java.lang.String> targetOperations, java.util.List<java.lang.String> passedRoles, Delegator delegator, Security security, java.lang.String entityAction, java.lang.String privilegeEnumId)
static java.util.Map<java.lang.String,java.lang.Object>
checkPermission(GenericValue content, java.util.List<java.lang.String> statusList, GenericValue userLogin, java.util.List<java.lang.String> passedPurposes, java.util.List<java.lang.String> targetOperations, java.util.List<java.lang.String> passedRoles, Delegator delegator, Security security, java.lang.String entityAction, java.lang.String privilegeEnumId, java.lang.String quickCheckContentId)
static boolean
checkPermissionMethod(Delegator delegator, java.lang.String partyId, java.lang.String entityName, java.util.List<? extends java.lang.Object> entityIdList, EntityPermissionChecker.AuxiliaryValueGetter auxiliaryValueGetter, EntityPermissionChecker.RelatedRoleGetter relatedRoleGetter, EntityPermissionChecker.PermissionConditionGetter permissionConditionGetter)
static boolean
checkPermissionMethod(Delegator delegator, GenericValue userLogin, java.util.List<java.lang.String> targetOperationList, java.lang.String entityName, java.util.List<? extends java.lang.Object> entityIdList, java.util.List<java.lang.String> purposeList, java.util.List<java.lang.String> roleList, java.lang.String privilegeEnumId)
static void
getEntityOwners(Delegator delegator, GenericValue entity, java.util.List<java.lang.String> contentOwnerList, java.lang.String entityName, java.lang.String ownerIdFieldName)
static GenericValue
getNextEntity(Delegator delegator, java.lang.String entityName, java.lang.String pkFieldName, java.lang.Object obj, java.util.Map<java.lang.String,GenericValue> entities)
static int
getPrivilegeEnumSeq(Delegator delegator, java.lang.String privilegeEnumId)
static java.util.List<java.lang.String>
getRelatedPurposes(GenericValue entity, java.util.List<java.lang.String> passedPurposes)
getRelatedPurposesstatic java.util.List<java.lang.String>
getUserRoles(GenericValue entity, GenericValue userLogin, Delegator delegator)
getUserRoles Queries for the ContentRoles associated with a Content entity and returns the ones that match the user.static java.util.List<java.lang.String>
getUserRolesFromList(Delegator delegator, java.util.List<java.lang.String> idList, java.lang.String partyId, java.lang.String entityIdFieldName, java.lang.String partyIdFieldName, java.lang.String roleTypeIdFieldName, java.lang.String entityName)
static boolean
hasMatch(java.lang.String entityName, java.util.List<GenericValue> targetOperations, java.util.List<java.lang.String> roles, boolean hasPurposeOp, java.util.List<java.lang.String> purposes, boolean hasStatusOp, java.lang.String targStatusId)
static boolean
hasMatch(GenericValue entity, EntityPermissionChecker.PermissionConditionGetter permissionConditionGetter, EntityPermissionChecker.RelatedRoleGetter relatedRoleGetter, EntityPermissionChecker.AuxiliaryValueGetter auxiliaryValueGetter, java.lang.String partyId, boolean checkAncestors)
static boolean
isGroupMember(java.util.Map<java.lang.String,?> partyRelationshipValues, Delegator delegator)
Tests to see if the user belongs to a groupboolean
runPermissionCheck(java.util.Map<java.lang.String,?> context)
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
entityIdExdr
protected FlexibleStringExpander entityIdExdr
-
entityNameExdr
protected FlexibleStringExpander entityNameExdr
-
displayFailCond
protected boolean displayFailCond
-
targetOperationList
protected java.util.List<java.lang.String> targetOperationList
-
permissionConditionGetter
protected EntityPermissionChecker.PermissionConditionGetter permissionConditionGetter
-
relatedRoleGetter
protected EntityPermissionChecker.RelatedRoleGetter relatedRoleGetter
-
auxiliaryValueGetter
protected EntityPermissionChecker.AuxiliaryValueGetter auxiliaryValueGetter
-
-
Method Detail
-
runPermissionCheck
public boolean runPermissionCheck(java.util.Map<java.lang.String,?> context)
-
checkPermission
public static java.util.Map<java.lang.String,java.lang.Object> checkPermission(GenericValue content, java.lang.String statusId, GenericValue userLogin, java.util.List<java.lang.String> passedPurposes, java.util.List<java.lang.String> targetOperations, java.util.List<java.lang.String> passedRoles, Delegator delegator, Security security, java.lang.String entityAction)
-
checkPermission
public static java.util.Map<java.lang.String,java.lang.Object> checkPermission(GenericValue content, java.lang.String statusId, GenericValue userLogin, java.util.List<java.lang.String> passedPurposes, java.util.List<java.lang.String> targetOperations, java.util.List<java.lang.String> passedRoles, Delegator delegator, Security security, java.lang.String entityAction, java.lang.String privilegeEnumId, java.lang.String quickCheckContentId)
-
checkPermission
public static java.util.Map<java.lang.String,java.lang.Object> checkPermission(GenericValue content, java.util.List<java.lang.String> statusList, GenericValue userLogin, java.util.List<java.lang.String> passedPurposes, java.util.List<java.lang.String> targetOperations, java.util.List<java.lang.String> passedRoles, Delegator delegator, Security security, java.lang.String entityAction, java.lang.String privilegeEnumId)
-
checkPermission
public static java.util.Map<java.lang.String,java.lang.Object> checkPermission(GenericValue content, java.util.List<java.lang.String> statusList, GenericValue userLogin, java.util.List<java.lang.String> passedPurposes, java.util.List<java.lang.String> targetOperations, java.util.List<java.lang.String> passedRoles, Delegator delegator, Security security, java.lang.String entityAction, java.lang.String privilegeEnumId, java.lang.String quickCheckContentId)
-
checkPermissionMethod
public static boolean checkPermissionMethod(Delegator delegator, GenericValue userLogin, java.util.List<java.lang.String> targetOperationList, java.lang.String entityName, java.util.List<? extends java.lang.Object> entityIdList, java.util.List<java.lang.String> purposeList, java.util.List<java.lang.String> roleList, java.lang.String privilegeEnumId) throws GenericEntityException
- Throws:
GenericEntityException
-
checkPermissionMethod
public static boolean checkPermissionMethod(Delegator delegator, java.lang.String partyId, java.lang.String entityName, java.util.List<? extends java.lang.Object> entityIdList, EntityPermissionChecker.AuxiliaryValueGetter auxiliaryValueGetter, EntityPermissionChecker.RelatedRoleGetter relatedRoleGetter, EntityPermissionChecker.PermissionConditionGetter permissionConditionGetter) throws GenericEntityException
- Throws:
GenericEntityException
-
getNextEntity
public static GenericValue getNextEntity(Delegator delegator, java.lang.String entityName, java.lang.String pkFieldName, java.lang.Object obj, java.util.Map<java.lang.String,GenericValue> entities) throws GenericEntityException
- Throws:
GenericEntityException
-
checkHasRoleOperations
public static boolean checkHasRoleOperations(java.lang.String partyId, EntityPermissionChecker.PermissionConditionGetter permissionConditionGetter, Delegator delegator)
-
checkHasRoleOperations
public static boolean checkHasRoleOperations(java.lang.String partyId, java.util.List<java.lang.String> targetOperations, Delegator delegator)
-
hasMatch
public static boolean hasMatch(java.lang.String entityName, java.util.List<GenericValue> targetOperations, java.util.List<java.lang.String> roles, boolean hasPurposeOp, java.util.List<java.lang.String> purposes, boolean hasStatusOp, java.lang.String targStatusId)
-
hasMatch
public static boolean hasMatch(GenericValue entity, EntityPermissionChecker.PermissionConditionGetter permissionConditionGetter, EntityPermissionChecker.RelatedRoleGetter relatedRoleGetter, EntityPermissionChecker.AuxiliaryValueGetter auxiliaryValueGetter, java.lang.String partyId, boolean checkAncestors) throws GenericEntityException
- Throws:
GenericEntityException
-
getRelatedPurposes
public static java.util.List<java.lang.String> getRelatedPurposes(GenericValue entity, java.util.List<java.lang.String> passedPurposes)
getRelatedPurposes
-
getUserRoles
public static java.util.List<java.lang.String> getUserRoles(GenericValue entity, GenericValue userLogin, Delegator delegator) throws GenericEntityException
getUserRoles Queries for the ContentRoles associated with a Content entity and returns the ones that match the user. Follows group parties to see if the user is a member.- Throws:
GenericEntityException
-
isGroupMember
public static boolean isGroupMember(java.util.Map<java.lang.String,?> partyRelationshipValues, Delegator delegator)
Tests to see if the user belongs to a group
-
getUserRolesFromList
public static java.util.List<java.lang.String> getUserRolesFromList(Delegator delegator, java.util.List<java.lang.String> idList, java.lang.String partyId, java.lang.String entityIdFieldName, java.lang.String partyIdFieldName, java.lang.String roleTypeIdFieldName, java.lang.String entityName) throws GenericEntityException
- Throws:
GenericEntityException
-
getEntityOwners
public static void getEntityOwners(Delegator delegator, GenericValue entity, java.util.List<java.lang.String> contentOwnerList, java.lang.String entityName, java.lang.String ownerIdFieldName) throws GenericEntityException
- Throws:
GenericEntityException
-
getPrivilegeEnumSeq
public static int getPrivilegeEnumSeq(Delegator delegator, java.lang.String privilegeEnumId) throws GenericEntityException
- Throws:
GenericEntityException
-
-