Search in sources :

Example 1 with RestrictionDefinitionImpl

use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl in project jackrabbit-oak by apache.

the class AbstractRestrictionProviderTest method before.

@Before
@Override
public void before() throws Exception {
    super.before();
    valueFactory = new ValueFactoryImpl(root, namePathMapper);
    globValue = valueFactory.createValue("*");
    nameValue = valueFactory.createValue("nt:file", PropertyType.NAME);
    nameValues = new Value[] { valueFactory.createValue("nt:folder", PropertyType.NAME), valueFactory.createValue("nt:file", PropertyType.NAME) };
    RestrictionDefinition glob = new RestrictionDefinitionImpl(REP_GLOB, Type.STRING, false);
    RestrictionDefinition nts = new RestrictionDefinitionImpl(REP_NT_NAMES, Type.NAMES, false);
    RestrictionDefinition mand = new RestrictionDefinitionImpl("mandatory", Type.BOOLEAN, true);
    supported = ImmutableMap.of(glob.getName(), glob, nts.getName(), nts, mand.getName(), mand);
    restrictionProvider = new TestProvider(supported);
}
Also used : ValueFactoryImpl(org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl) RestrictionDefinitionImpl(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl) RestrictionDefinition(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinition) Before(org.junit.Before)

Example 2 with RestrictionDefinitionImpl

use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl in project jackrabbit-oak by apache.

the class PrincipalRestrictionProvider method getSupportedRestrictions.

@Nonnull
@Override
public Set<RestrictionDefinition> getSupportedRestrictions(@Nullable String oakPath) {
    Set<RestrictionDefinition> definitions = new HashSet<RestrictionDefinition>(base.getSupportedRestrictions(oakPath));
    definitions.add(new RestrictionDefinitionImpl(REP_NODE_PATH, Type.PATH, true));
    return definitions;
}
Also used : RestrictionDefinitionImpl(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl) RestrictionDefinition(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinition) HashSet(java.util.HashSet) Nonnull(javax.annotation.Nonnull)

Example 3 with RestrictionDefinitionImpl

use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl in project jackrabbit-oak by apache.

the class AbstractAccessControlListTest method getRestrictionProvider.

protected RestrictionProvider getRestrictionProvider() {
    Map<String, RestrictionDefinition> rDefs = new HashMap();
    rDefs.put("r1", new RestrictionDefinitionImpl("r1", Type.STRING, true));
    rDefs.put("r2", new RestrictionDefinitionImpl("r2", Type.LONGS, false));
    return new AbstractRestrictionProvider(rDefs) {

        @Nonnull
        @Override
        public RestrictionPattern getPattern(@Nullable String oakPath, @Nonnull Tree tree) {
            throw new UnsupportedOperationException();
        }

        @Nonnull
        @Override
        public RestrictionPattern getPattern(@Nullable String oakPath, @Nonnull Set<Restriction> restrictions) {
            throw new UnsupportedOperationException();
        }
    };
}
Also used : AbstractRestrictionProvider(org.apache.jackrabbit.oak.spi.security.authorization.restriction.AbstractRestrictionProvider) Set(java.util.Set) HashMap(java.util.HashMap) Nonnull(javax.annotation.Nonnull) RestrictionDefinitionImpl(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl) Tree(org.apache.jackrabbit.oak.api.Tree) RestrictionDefinition(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinition) Nullable(javax.annotation.Nullable)

Example 4 with RestrictionDefinitionImpl

use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl in project sling by apache.

the class SlingRestrictionProviderImpl method supportedRestrictions.

private static Map<String, RestrictionDefinition> supportedRestrictions() {
    RestrictionDefinition slingResourceTypes = new RestrictionDefinitionImpl(SLING_RESOURCE_TYPES, Type.STRINGS, false);
    RestrictionDefinition slingResourceTypesWithChildren = new RestrictionDefinitionImpl(SLING_RESOURCE_TYPES_WITH_DESCENDANTS, Type.STRINGS, false);
    Map<String, RestrictionDefinition> supportedRestrictions = new HashMap<String, RestrictionDefinition>();
    supportedRestrictions.put(slingResourceTypes.getName(), slingResourceTypes);
    supportedRestrictions.put(slingResourceTypesWithChildren.getName(), slingResourceTypesWithChildren);
    return Collections.unmodifiableMap(supportedRestrictions);
}
Also used : HashMap(java.util.HashMap) RestrictionDefinitionImpl(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl) RestrictionDefinition(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinition)

Example 5 with RestrictionDefinitionImpl

use of org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl in project jackrabbit-oak by apache.

the class RestrictionProviderImpl method supportedRestrictions.

private static Map<String, RestrictionDefinition> supportedRestrictions() {
    RestrictionDefinition glob = new RestrictionDefinitionImpl(REP_GLOB, Type.STRING, false);
    RestrictionDefinition nts = new RestrictionDefinitionImpl(REP_NT_NAMES, Type.NAMES, false);
    RestrictionDefinition pfxs = new RestrictionDefinitionImpl(REP_PREFIXES, Type.STRINGS, false);
    RestrictionDefinition names = new RestrictionDefinitionImpl(REP_ITEM_NAMES, Type.NAMES, false);
    return ImmutableMap.of(glob.getName(), glob, nts.getName(), nts, pfxs.getName(), pfxs, names.getName(), names);
}
Also used : RestrictionDefinitionImpl(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl) RestrictionDefinition(org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinition)

Aggregations

RestrictionDefinition (org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinition)5 RestrictionDefinitionImpl (org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionDefinitionImpl)5 HashMap (java.util.HashMap)2 Nonnull (javax.annotation.Nonnull)2 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Nullable (javax.annotation.Nullable)1 Tree (org.apache.jackrabbit.oak.api.Tree)1 ValueFactoryImpl (org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl)1 AbstractRestrictionProvider (org.apache.jackrabbit.oak.spi.security.authorization.restriction.AbstractRestrictionProvider)1 Before (org.junit.Before)1