Search in sources :

Example 1 with RestrictedAccessMode

use of org.neo4j.kernel.impl.api.security.RestrictedAccessMode in project neo4j by neo4j.

the class EnterpriseSecurityContextDescriptionTest method shouldMakeNiceDescriptionAuthDisabledAndRestricted.

@Test
public void shouldMakeNiceDescriptionAuthDisabledAndRestricted() throws Throwable {
    EnterpriseSecurityContext disabled = EnterpriseSecurityContext.AUTH_DISABLED;
    EnterpriseSecurityContext restricted = disabled.withMode(new RestrictedAccessMode(disabled.mode(), AccessMode.Static.READ));
    assertThat(restricted.description(), equalTo("AUTH_DISABLED with FULL restricted to READ"));
}
Also used : EnterpriseSecurityContext(org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext) RestrictedAccessMode(org.neo4j.kernel.impl.api.security.RestrictedAccessMode) Test(org.junit.Test)

Example 2 with RestrictedAccessMode

use of org.neo4j.kernel.impl.api.security.RestrictedAccessMode in project neo4j by neo4j.

the class EnterpriseSecurityContextDescriptionTest method shouldMakeNiceDescriptionRestricted.

@Test
public void shouldMakeNiceDescriptionRestricted() throws Throwable {
    manager.newRole("role1", "mats");
    manager.addRoleToUser(PUBLISHER, "mats");
    EnterpriseSecurityContext restricted = context.withMode(new RestrictedAccessMode(context.mode(), AccessMode.Static.READ));
    assertThat(restricted.description(), equalTo("user 'mats' with roles [publisher,role1] restricted to READ"));
}
Also used : EnterpriseSecurityContext(org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext) RestrictedAccessMode(org.neo4j.kernel.impl.api.security.RestrictedAccessMode) Test(org.junit.Test)

Example 3 with RestrictedAccessMode

use of org.neo4j.kernel.impl.api.security.RestrictedAccessMode in project neo4j by neo4j.

the class SecurityContextDescriptionTest method shouldMakeNiceDescriptionAuthDisabledAndRestricted.

@Test
public void shouldMakeNiceDescriptionAuthDisabledAndRestricted() throws Throwable {
    SecurityContext disabled = SecurityContext.AUTH_DISABLED;
    SecurityContext restricted = disabled.withMode(new RestrictedAccessMode(disabled.mode(), AccessMode.Static.READ));
    assertThat(restricted.description(), equalTo("AUTH_DISABLED with FULL restricted to READ"));
}
Also used : RestrictedAccessMode(org.neo4j.kernel.impl.api.security.RestrictedAccessMode) SecurityContext(org.neo4j.kernel.api.security.SecurityContext) Test(org.junit.Test)

Example 4 with RestrictedAccessMode

use of org.neo4j.kernel.impl.api.security.RestrictedAccessMode in project neo4j by neo4j.

the class SecurityContextDescriptionTest method shouldMakeNiceDescriptionRestricted.

@Test
public void shouldMakeNiceDescriptionRestricted() throws Throwable {
    SecurityContext restricted = context.withMode(new RestrictedAccessMode(context.mode(), AccessMode.Static.READ));
    assertThat(restricted.description(), equalTo("user 'johan' with FULL restricted to READ"));
}
Also used : RestrictedAccessMode(org.neo4j.kernel.impl.api.security.RestrictedAccessMode) SecurityContext(org.neo4j.kernel.api.security.SecurityContext) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 RestrictedAccessMode (org.neo4j.kernel.impl.api.security.RestrictedAccessMode)4 SecurityContext (org.neo4j.kernel.api.security.SecurityContext)2 EnterpriseSecurityContext (org.neo4j.kernel.enterprise.api.security.EnterpriseSecurityContext)2