use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class PrincipalNodeTranslator method createUserProfileFromNode.
private static void createUserProfileFromNode(final PropertyTree nodeAsTree, final User.Builder user) {
final PropertySet nodeProfile = nodeAsTree.getSet(PrincipalPropertyNames.PROFILE_KEY);
final PropertyTree profile = nodeProfile == null ? new PropertyTree() : nodeProfile.toTree();
user.profile(profile);
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class PrincipalNodeTranslator method createRoleFromNode.
private static Role createRoleFromNode(final Node node) {
Preconditions.checkNotNull(node);
final PropertyTree nodeAsTree = node.data();
return Role.create().key(PrincipalKeyNodeTranslator.toKey(node)).displayName(nodeAsTree.getString(PrincipalPropertyNames.DISPLAY_NAME_KEY)).description(nodeAsTree.getString(PrincipalPropertyNames.DESCRIPTION_KEY)).build();
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class PrincipalNodeTranslator method relationshipsFromNode.
static PrincipalRelationships relationshipsFromNode(final Node node) {
final PropertyTree rootDataSet = node.data();
final List<Property> members = rootDataSet.getProperties(PrincipalPropertyNames.MEMBER_KEY);
if (members == null || members.isEmpty()) {
return PrincipalRelationships.empty();
}
final ImmutableList.Builder<PrincipalRelationship> relationships = ImmutableList.builder();
final PrincipalKey relationshipFrom = PrincipalKeyNodeTranslator.toKey(node);
for (Property member : members) {
final String memberKey = member.getValue().asString();
final PrincipalKey relationshipTo = PrincipalKey.from(memberKey);
final PrincipalRelationship relationship = PrincipalRelationship.from(relationshipFrom).to(relationshipTo);
relationships.add(relationship);
}
return PrincipalRelationships.from(relationships.build());
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class SecurityAuditLogSupportImpl method createUser.
@Override
public void createUser(final CreateUserParams 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.create", data, AuditLogUris.from(params.getKey().toString()));
}
}
use of com.enonic.xp.data.PropertyTree in project xp by enonic.
the class SecurityAuditLogSupportImpl method createGroup.
@Override
public void createGroup(final CreateGroupParams 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.principal.create", data, AuditLogUris.from(params.getKey().toString()));
}
}
Aggregations