本文整理了Java中org.apache.jackrabbit.oak.api.Root.getContentSession
方法的一些代码示例,展示了Root.getContentSession
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Root.getContentSession
方法的具体详情如下:
包路径:org.apache.jackrabbit.oak.api.Root
类名称:Root
方法名:getContentSession
[英]Get the ContentSession from which this root was acquired
[中]获取获取此根目录的ContentSession
代码示例来源:origin: apache/jackrabbit-oak
@NotNull
protected Root getLatestRoot() {
return root.getContentSession().getLatestRoot();
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public boolean init(@NotNull Session session, @NotNull Root root, @NotNull NamePathMapper namePathMapper, boolean isWorkspaceImport, int uuidBehavior, @NotNull ReferenceChangeTracker referenceTracker, @NotNull SecurityProvider securityProvider) {
isSystemSession = root.getContentSession().getAuthInfo().getPrincipals().contains(SystemPrincipal.INSTANCE);
return true;
}
代码示例来源:origin: apache/jackrabbit-oak
@NotNull
@Override
public ContentSession getContentSession() {
return base.getContentSession();
}
}
代码示例来源:origin: apache/jackrabbit-oak
@NotNull
private Set<Principal> getPrincipals() {
return root.getContentSession().getAuthInfo().getPrincipals();
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
protected AbstractAccessControlManager(@Nonnull Root root,
@Nonnull NamePathMapper namePathMapper,
@Nonnull SecurityProvider securityProvider) {
this.root = root;
this.workspaceName = root.getContentSession().getWorkspaceName();
this.namePathMapper = namePathMapper;
privilegeManager = securityProvider.getConfiguration(PrivilegeConfiguration.class).getPrivilegeManager(root, namePathMapper);
config = securityProvider.getConfiguration(AuthorizationConfiguration.class);
}
代码示例来源:origin: org.apache.jackrabbit/oak-core
UserPrincipalProvider(@NotNull Root root,
@NotNull UserConfiguration userConfiguration,
@NotNull NamePathMapper namePathMapper) {
this.root = root;
this.config = userConfiguration;
this.namePathMapper = namePathMapper;
this.userProvider = new UserProvider(root, config.getParameters());
this.membershipProvider = new MembershipProvider(root, config.getParameters());
expiration = config.getParameters().getConfigValue(PARAM_CACHE_EXPIRATION, EXPIRATION_NO_CACHE);
cacheEnabled = (expiration > EXPIRATION_NO_CACHE && root.getContentSession().getAuthInfo().getPrincipals().contains(SystemPrincipal.INSTANCE));
}
代码示例来源:origin: apache/jackrabbit-oak
UserPrincipalProvider(@NotNull Root root,
@NotNull UserConfiguration userConfiguration,
@NotNull NamePathMapper namePathMapper) {
this.root = root;
this.config = userConfiguration;
this.namePathMapper = namePathMapper;
this.userProvider = new UserProvider(root, config.getParameters());
this.membershipProvider = new MembershipProvider(root, config.getParameters());
expiration = config.getParameters().getConfigValue(PARAM_CACHE_EXPIRATION, EXPIRATION_NO_CACHE);
cacheEnabled = (expiration > EXPIRATION_NO_CACHE && root.getContentSession().getAuthInfo().getPrincipals().contains(SystemPrincipal.INSTANCE));
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak
UserPrincipalProvider(@Nonnull Root root,
@Nonnull UserConfiguration userConfiguration,
@Nonnull NamePathMapper namePathMapper) {
this.root = root;
this.config = userConfiguration;
this.namePathMapper = namePathMapper;
this.userProvider = new UserProvider(root, config.getParameters());
this.membershipProvider = new MembershipProvider(root, config.getParameters());
expiration = config.getParameters().getConfigValue(PARAM_CACHE_EXPIRATION, EXPIRATION_NO_CACHE);
cacheEnabled = (expiration > EXPIRATION_NO_CACHE && root.getContentSession().getAuthInfo().getPrincipals().contains(SystemPrincipal.INSTANCE));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSingleGetPermissionProvider() {
CompositeAuthorizationConfiguration cc = getCompositeConfiguration(createAuthorizationConfigurationImpl());
PermissionProvider pp = cc.getPermissionProvider(root, root.getContentSession().getWorkspaceName(), Collections.<Principal>emptySet());
assertFalse(pp instanceof CompositePermissionProvider);
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testMultipleGetPermissionProvider2() {
CompositeAuthorizationConfiguration cc = getCompositeConfiguration(
createAuthorizationConfigurationImpl(),
createAuthorizationConfigurationImpl());
PermissionProvider pp = cc.getPermissionProvider(root, root.getContentSession().getWorkspaceName(), Collections.<Principal>emptySet());
assertTrue(pp instanceof CompositePermissionProvider);
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void getLoginContextWithoutCredentials() throws Exception {
LoginContext ctx = lcProvider.getLoginContext(null, root.getContentSession().getWorkspaceName());
assertNotNull(ctx);
assertTrue(ctx instanceof JaasLoginContext);
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testGetPermissionProviderDisabled() {
CugConfiguration cc = createConfiguration(ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, false));
PermissionProvider pp = cc.getPermissionProvider(root, root.getContentSession().getWorkspaceName(), ImmutableSet.<Principal>of(EveryonePrincipal.getInstance()));
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testGetLoginContext() throws Exception {
LoginContext ctx = lcProvider.getLoginContext(new SimpleCredentials(getTestUser().getID(), getTestUser().getID().toCharArray()), root.getContentSession().getWorkspaceName());
Subject subject = ctx.getSubject();
assertNotNull(subject);
assertFalse(subject.isReadOnly());
assertTrue(subject.getPrincipals().isEmpty());
}
代码示例来源:origin: apache/jackrabbit-oak
CompositePermissionProvider createPermissionProvider(Set<Principal> principals) {
String workspaceName = root.getContentSession().getWorkspaceName();
AuthorizationConfiguration config = getConfig(AuthorizationConfiguration.class);
return new CompositePermissionProvider(root, getAggregatedProviders(workspaceName, config, principals),
config.getContext(), CompositionType.AND, getRootProvider(), getTreeProvider());
}
代码示例来源:origin: apache/jackrabbit-oak
CompositePermissionProvider createPermissionProviderOR(Set<Principal> principals) {
String workspaceName = root.getContentSession().getWorkspaceName();
AuthorizationConfiguration config = getConfig(AuthorizationConfiguration.class);
return new CompositePermissionProvider(root, getAggregatedProviders(workspaceName, config, principals),
config.getContext(), CompositionType.OR, getRootProvider(), getTreeProvider());
}
代码示例来源:origin: apache/jackrabbit-oak
@Override
public void before() throws Exception {
super.before();
cppTestUser = createPermissionProvider(getTestUser().getPrincipal(), EveryonePrincipal.getInstance());
cppAdminUser = createPermissionProvider(root.getContentSession().getAuthInfo().getPrincipals());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testTestSessionHasRepoPrivileges() throws Exception {
AbstractAccessControlManager testAcMgr = getTestAccessControlManager();
assertFalse(testAcMgr.hasPrivileges(null, testPrivileges));
assertFalse(testAcMgr.hasPrivileges(null, getPrincipals(getTestRoot().getContentSession()), testPrivileges));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testMissingPermissionRoot() throws Exception {
ContentRepository repo = new Oak().with(new OpenSecurityProvider()).createContentRepository();
Root tmpRoot = repo.login(null, null).getLatestRoot();
try {
PrivilegeDefinitionReader reader = new PrivilegeDefinitionReader(tmpRoot);
assertNull(reader.readDefinition(JCR_READ));
} finally {
tmpRoot.getContentSession().close();
}
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void handleRepositoryCallback() throws Exception {
RepositoryCallback cb = new RepositoryCallback();
callbackHandler.handle(new Callback[] {cb});
assertSame(getContentRepository(), cb.getContentRepository());
assertSame(getSecurityProvider(), cb.getSecurityProvider());
assertEquals(root.getContentSession().getWorkspaceName(), cb.getWorkspaceName());
}
代码示例来源:origin: apache/jackrabbit-oak
@Before
public void before() throws Exception {
super.before();
testPrincipal = getTestUser().getPrincipal();
NodeUtil rootNode = new NodeUtil(root.getTree("/"), namePathMapper);
NodeUtil testNode = rootNode.addChild("testPath", JcrConstants.NT_UNSTRUCTURED);
testNode.addChild("childNode", JcrConstants.NT_UNSTRUCTURED);
addAcl(testPath, EveryonePrincipal.getInstance());
addAcl(childPath, EveryonePrincipal.getInstance());
root.commit();
permissionStore = new PermissionStoreImpl(root, root.getContentSession().getWorkspaceName(), getConfig(AuthorizationConfiguration.class).getRestrictionProvider());
}
内容来源于网络,如有侵权,请联系作者删除!