use of com.enonic.xp.data.PropertySet 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()));
}
}
use of com.enonic.xp.data.PropertySet 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()));
}
}
use of com.enonic.xp.data.PropertySet 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()));
}
}
use of com.enonic.xp.data.PropertySet 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);
}
}
use of com.enonic.xp.data.PropertySet in project xp by enonic.
the class ModifyNodeHandlerTest method testExample.
@Test
public void testExample() {
final PropertyTree data = new PropertyTree();
data.setString("notChanged", "originalValue");
data.setString("myString", "originalValue");
data.setString("toBeRemoved", "removeThis");
final PropertySet mySet = data.addSet("mySet");
mySet.setGeoPoint("myGeoPoint", new GeoPoint(30, -30));
final Node node = Node.create().id(NodeId.from("abc")).parentPath(NodePath.ROOT).data(data).name("myNode").build();
mockGetNode(node);
mockUpdateNode(node);
runScript("/lib/xp/examples/node/modify.js");
Mockito.verify(this.nodeService).update(updateCaptor.capture());
assertEquals(updateCaptor.getValue().getId(), NodeId.from("abc"));
final EditableNode editedNode = getEditedNode(node);
assertEquals("modified", editedNode.data.getString("myString"));
assertEquals("originalValue", editedNode.data.getString("notChanged"));
assertEquals(new GeoPoint(0, 0), editedNode.data.getGeoPoint("mySet.myGeoPoint"));
final Iterable<String> myArray = editedNode.data.getStrings("myArray");
assertNotNull(myArray);
final ArrayList<String> myArrayValues = Lists.newArrayList(myArray);
assertEquals(3, myArrayValues.size());
assertTrue(myArrayValues.containsAll(List.of("modified1", "modified2", "modified3")));
final AccessControlList permissions = editedNode.permissions;
assertTrue(permissions.getEntry(PrincipalKey.from("role:newRole")).isAllowed(Permission.MODIFY));
assertTrue(permissions.getEntry(PrincipalKey.from("user:system:newUser")).isAllowed(Permission.CREATE));
final IndexConfigDocument indexConfigDocument = editedNode.indexConfigDocument;
assertFalse(indexConfigDocument.getConfigForPath(PropertyPath.from("displayName")).isEnabled());
assertTrue(indexConfigDocument.getConfigForPath(PropertyPath.from("whatever")).isFulltext());
}
Aggregations