Search in sources :

Example 41 with PropertyTree

use of com.enonic.xp.data.PropertyTree in project xp by enonic.

the class SecurityAuditLogSupportImpl method createIdProvider.

@Override
public void createIdProvider(final CreateIdProviderParams params) {
    if (isEnabledAuditLogs) {
        PropertyTree data = new PropertyTree();
        PropertySet paramsSet = data.addSet("params");
        paramsSet.setString("key", params.getKey().toString());
        paramsSet.setString("displayName", params.getDisplayName());
        paramsSet.setString("description", params.getDescription());
        log("system.security.idProvider.create", data, AuditLogUris.from(params.getKey().toString()));
    }
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 42 with PropertyTree

use of com.enonic.xp.data.PropertyTree in project xp by enonic.

the class SecurityAuditLogSupportImpl method updateUser.

@Override
public void updateUser(final UpdateUserParams params) {
    if (isEnabledAuditLogs) {
        PropertyTree data = new PropertyTree();
        PropertySet paramsSet = data.addSet("params");
        paramsSet.setString("key", params.getKey().toString());
        paramsSet.setString("email", params.getEmail());
        paramsSet.setString("login", params.getLogin());
        paramsSet.setString("displayName", params.getDisplayName());
        log("system.security.principal.update", data, AuditLogUris.from(params.getKey().toString()));
    }
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 43 with PropertyTree

use of com.enonic.xp.data.PropertyTree in project xp by enonic.

the class SecurityAuditLogSupportImpl method removePrincipal.

@Override
public void removePrincipal(final PrincipalKey principalKey) {
    if (isEnabledAuditLogs) {
        PropertyTree data = new PropertyTree();
        PropertySet paramsSet = data.addSet("params");
        paramsSet.setString("key", principalKey.toString());
        log("system.security.principal.delete", data, AuditLogUris.from(principalKey.toString()));
    }
}
Also used : PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 44 with PropertyTree

use of com.enonic.xp.data.PropertyTree in project xp by enonic.

the class SecurityAuditLogSupportImpl method addRelationship.

@Override
public void addRelationship(final PrincipalRelationship relationship) {
    if (isEnabledAuditLogs) {
        PropertyTree data = new PropertyTree();
        PropertySet paramsSet = data.addSet("params");
        paramsSet.setString("principal", relationship.getTo().toString());
        paramsSet.setString("joins", relationship.getFrom().toString());
        AuditLogUris auditLogUris = AuditLogUris.from(relationship.getTo().toString(), relationship.getFrom().toString());
        log("system.security.principal.addRelationship", data, auditLogUris);
    }
}
Also used : AuditLogUris(com.enonic.xp.audit.AuditLogUris) PropertyTree(com.enonic.xp.data.PropertyTree) PropertySet(com.enonic.xp.data.PropertySet)

Example 45 with PropertyTree

use of com.enonic.xp.data.PropertyTree in project xp by enonic.

the class GroupNodeTranslatorTest method toGroup.

@Test
public void toGroup() throws Exception {
    final PrincipalKey groupKey = PrincipalKey.ofGroup(IdProviderKey.system(), "group-a");
    final PropertyTree rootDataSet = new PropertyTree();
    rootDataSet.setString(PrincipalPropertyNames.DISPLAY_NAME_KEY, "Group A");
    rootDataSet.setString(PrincipalPropertyNames.PRINCIPAL_TYPE_KEY, groupKey.getType().toString());
    rootDataSet.setString(PrincipalPropertyNames.ID_PROVIDER_KEY, groupKey.getIdProviderKey().toString());
    final Node node = Node.create().id(NodeId.from("id")).name(PrincipalKeyNodeTranslator.toNodeName(groupKey)).data(rootDataSet).build();
    final Group group = PrincipalNodeTranslator.groupFromNode(node);
    assertEquals(groupKey, group.getKey());
}
Also used : Group(com.enonic.xp.security.Group) PropertyTree(com.enonic.xp.data.PropertyTree) Node(com.enonic.xp.node.Node) PrincipalKey(com.enonic.xp.security.PrincipalKey) Test(org.junit.jupiter.api.Test)

Aggregations

PropertyTree (com.enonic.xp.data.PropertyTree)660 Test (org.junit.jupiter.api.Test)405 PropertySet (com.enonic.xp.data.PropertySet)150 Content (com.enonic.xp.content.Content)126 Node (com.enonic.xp.node.Node)112 CreateContentParams (com.enonic.xp.content.CreateContentParams)64 Form (com.enonic.xp.form.Form)37 Page (com.enonic.xp.page.Page)32 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)31 DescriptorKey (com.enonic.xp.page.DescriptorKey)30 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)30 CreateNodeParams (com.enonic.xp.node.CreateNodeParams)28 PrincipalKey (com.enonic.xp.security.PrincipalKey)28 BinaryReference (com.enonic.xp.util.BinaryReference)28 Property (com.enonic.xp.data.Property)26 UpdateContentParams (com.enonic.xp.content.UpdateContentParams)24 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)23 ByteSource (com.google.common.io.ByteSource)22 ExtraData (com.enonic.xp.content.ExtraData)21 Instant (java.time.Instant)21