Search in sources :

Example 1 with AccessControlEntry

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

the class PermissionsMapper method serialize.

@Override
public void serialize(final MapGenerator gen) {
    gen.value(INHERITS_PERMISSIONS, node.inheritsPermissions());
    if (!node.getPermissions().isEmpty()) {
        gen.array(NodePropertyConstants.PERMISSIONS);
        for (AccessControlEntry accessControlEntry : node.getPermissions()) {
            gen.map();
            serialize(gen, accessControlEntry);
            gen.end();
        }
        gen.end();
    }
}
Also used : AccessControlEntry(com.enonic.xp.security.acl.AccessControlEntry)

Example 2 with AccessControlEntry

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

the class PermissionsMapper method serialize.

@Override
public void serialize(final MapGenerator gen) {
    gen.value("inheritsPermissions", content.inheritsPermissions());
    if (!content.getPermissions().isEmpty()) {
        gen.array("permissions");
        for (AccessControlEntry accessControlEntry : content.getPermissions()) {
            gen.map();
            serialize(gen, accessControlEntry);
            gen.end();
        }
        gen.end();
    }
}
Also used : AccessControlEntry(com.enonic.xp.security.acl.AccessControlEntry)

Example 3 with AccessControlEntry

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

the class PermissionsFactoryTest method checkDenied.

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

Example 4 with AccessControlEntry

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

the class ContentAuditLogSupportImpl method doCreateContent.

private void doCreateContent(final CreateContentParams params, final Content content, final Context rootContext) {
    final PropertyTree data = new PropertyTree();
    final PropertySet paramsSet = data.addSet("params");
    final PropertySet resultSet = data.addSet("result");
    paramsSet.addString("displayName", params.getDisplayName());
    paramsSet.addString("type", nullToNull(params.getType()));
    paramsSet.addString("name", nullToNull(params.getName()));
    paramsSet.addBoolean("requireValid", params.isRequireValid());
    paramsSet.addBoolean("inheritPermissions", params.isInheritPermissions());
    if (params.getProcessedIds() != null) {
        paramsSet.addStrings("processedIds", params.getProcessedIds().stream().map(ContentId::toString).collect(Collectors.toList()));
    }
    if (params.getPermissions() != null) {
        paramsSet.addStrings("permissions", params.getPermissions().getEntries().stream().map(AccessControlEntry::toString).collect(Collectors.toList()));
    }
    addContent(resultSet, content);
    log("system.content.create", data, content.getPath(), rootContext);
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet) AccessControlEntry(com.enonic.xp.security.acl.AccessControlEntry) ContentId(com.enonic.xp.content.ContentId)

Example 5 with AccessControlEntry

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

the class PermissionsXmlSerializer method serialize.

public void serialize() {
    this.domBuilder.start("permissions");
    for (final AccessControlEntry entry : this.accessControlList) {
        serialize(entry);
    }
    this.domBuilder.end();
}
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