use of com.enonic.xp.context.Context in project xp by enonic.
the class GetNodeByPathCommandTest method get_root.
@Test
public void get_root() throws Exception {
final Context systemContext = ContextBuilder.from(ContextAccessor.current()).repositoryId(SystemConstants.SYSTEM_REPO_ID).branch(SystemConstants.BRANCH_SYSTEM).build();
final Node rootNode = systemContext.callWith(() -> doGetNodeByPath(NodePath.ROOT));
assertNotNull(rootNode);
}
use of com.enonic.xp.context.Context in project xp by enonic.
the class SecurityAuditLogSupportImpl method log.
private void log(final String type, final PropertyTree data, final AuditLogUris uris) {
final Context context = ContextBuilder.copyOf(ContextAccessor.current()).build();
final PrincipalKey userPrincipalKey = context.getAuthInfo().getUser() != null ? context.getAuthInfo().getUser().getKey() : PrincipalKey.ofAnonymous();
ContextBuilder.from(context).authInfo(AuthenticationInfo.copyOf(context.getAuthInfo()).principals(RoleKeys.AUDIT_LOG).build()).build().callWith(() -> auditLogService.log(LogAuditLogParams.create().type(type).source(SOURCE).data(data).objectUris(uris).user(userPrincipalKey).build()));
}
use of com.enonic.xp.context.Context in project xp by enonic.
the class ContentAuditLogSupportImpl method setActiveContentVersion.
@Override
public void setActiveContentVersion(final ContentId contentId, final ContentVersionId versionId) {
final Context context = ContextBuilder.copyOf(ContextAccessor.current()).build();
executor.execute(() -> doSetActiveContentVersion(contentId, versionId, context));
}
use of com.enonic.xp.context.Context in project xp by enonic.
the class ContentAuditLogSupportImpl method move.
@Override
public void move(final MoveContentParams params, final MoveContentsResult result) {
final Context context = ContextBuilder.copyOf(ContextAccessor.current()).build();
executor.execute(() -> doMove(params, result, context));
}
use of com.enonic.xp.context.Context in project xp by enonic.
the class ContentAuditLogSupportImpl method update.
@Override
public void update(final UpdateContentParams params, final Content content) {
final Context context = ContextBuilder.copyOf(ContextAccessor.current()).build();
executor.execute(() -> doUpdate(params, content, context));
}
Aggregations