Search in sources :

Example 16 with AccessControlEntry

use of com.enonic.xp.security.acl.AccessControlEntry in project xp by enonic.

the class PermissionsFactoryTest method checkAllowed.

private void checkAllowed(final AccessControlList acl, final String principalKey, final Permission... allowed) {
    final AccessControlEntry principal = acl.getEntry(PrincipalKey.from(principalKey));
    if (principal == null) {
        fail("Missing entry for principal [" + principalKey + "]");
    }
    Arrays.stream(allowed).forEach((entry) -> assertTrue(principal.isAllowed(entry), "Should allow [" + entry + "]"));
}
Also used : AccessControlEntry(com.enonic.xp.security.acl.AccessControlEntry)

Aggregations

AccessControlEntry (com.enonic.xp.security.acl.AccessControlEntry)16 PropertyTree (com.enonic.xp.data.PropertyTree)4 AccessControlList (com.enonic.xp.security.acl.AccessControlList)4 IdProviderAccessControlEntry (com.enonic.xp.security.acl.IdProviderAccessControlEntry)4 ArrayList (java.util.ArrayList)4 PropertySet (com.enonic.xp.data.PropertySet)3 PrincipalKey (com.enonic.xp.security.PrincipalKey)3 IndexConfig (com.enonic.xp.index.IndexConfig)2 AttachedBinary (com.enonic.xp.node.AttachedBinary)2 Permission (com.enonic.xp.security.acl.Permission)2 Test (org.junit.jupiter.api.Test)2 ContentId (com.enonic.xp.content.ContentId)1 Value (com.enonic.xp.data.Value)1 ChildOrder (com.enonic.xp.index.ChildOrder)1 IndexValueProcessor (com.enonic.xp.index.IndexValueProcessor)1 PatternIndexConfigDocument (com.enonic.xp.index.PatternIndexConfigDocument)1 NodePath (com.enonic.xp.node.NodePath)1 NodeVersion (com.enonic.xp.node.NodeVersion)1 IndexItem (com.enonic.xp.repo.impl.elasticsearch.document.indexitem.IndexItem)1 IndexItemString (com.enonic.xp.repo.impl.elasticsearch.document.indexitem.IndexItemString)1