• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java AccessControlException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javax.jcr.security.AccessControlException的典型用法代码示例。如果您正苦于以下问题:Java AccessControlException类的具体用法?Java AccessControlException怎么用?Java AccessControlException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AccessControlException类属于javax.jcr.security包,在下文中一共展示了AccessControlException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: orderBefore

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Override
public void orderBefore(AccessControlEntry srcEntry, AccessControlEntry destEntry) throws RepositoryException {
    ACE src = checkACE(srcEntry);
    ACE dest = (destEntry == null) ? null : checkACE(destEntry);

    if (src.equals(dest)) {
        log.debug("'srcEntry' equals 'destEntry' -> no reordering required.");
        return;
    }

    int index = (dest == null) ? entries.size() - 1 : entries.indexOf(dest);
    if (index < 0) {
        throw new AccessControlException("'destEntry' not contained in this AccessControlList.");
    } else {
        if (entries.remove(src)) {
            // re-insert the srcEntry at the new position.
            entries.add(index, src);
        } else {
            // src entry not contained in this list.
            throw new AccessControlException("srcEntry not contained in this AccessControlList");
        }
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:24,代码来源:ACL.java


示例2: createRestriction

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Override
public Restriction createRestriction(String oakPath, String oakName, Value value) throws RepositoryException {
    RestrictionDefinition definition = getDefinition(oakPath, oakName);
    Type<?> requiredType = definition.getRequiredType();
    int tag = requiredType.tag();
    if (tag != PropertyType.UNDEFINED && tag != value.getType()) {
        throw new AccessControlException("Unsupported restriction: Expected value of type " + requiredType);
    }
    PropertyState propertyState;
    if (requiredType.isArray()) {
        propertyState = PropertyStates.createProperty(oakName, ImmutableList.of(value), tag);
    } else {
        propertyState = PropertyStates.createProperty(oakName, value);
    }
    return createRestriction(propertyState, definition);
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:17,代码来源:AbstractRestrictionProvider.java


示例3: validateRestrictions

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Override
public void validateRestrictions(@Nullable String oakPath, @Nonnull Tree aceTree) throws RepositoryException {
    Map<String,RestrictionDefinition> supported = getSupported(oakPath);
    Set<String> rNames = new HashSet<String>();
    for (Restriction r : readRestrictions(oakPath, aceTree)) {
        String name = getName(r);
        rNames.add(name);
        if (!supported.containsKey(name)) {
            throw new AccessControlException("Unsupported restriction: " + name + " at " + oakPath);
        }
        if (!r.getDefinition().equals(supported.get(name))) {
            throw new AccessControlException("Invalid restriction: " + name + " at " + oakPath);
        }
    }
    for (RestrictionDefinition def : supported.values()) {
        String defName = def.getName();
        if (hasRestrictionProperty(aceTree, defName) && !rNames.contains(defName)) {
            throw new AccessControlException("Invalid restriction " + defName + " at " + oakPath);
        }
        if (def.isMandatory() && !rNames.contains(defName)) {
            throw new AccessControlException("Mandatory restriction " + defName + " is missing.");
        }
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:25,代码来源:CompositeRestrictionProvider.java


示例4: getTree

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Nonnull
protected Tree getTree(@Nullable String oakPath, long permissions, boolean checkAcContent) throws RepositoryException {
    Tree tree = (oakPath == null) ? root.getTree("/") : root.getTree(oakPath);
    if (!tree.exists()) {
        throw new PathNotFoundException("No tree at " + oakPath);
    }
    if (permissions != Permissions.NO_PERMISSION) {
        // check permissions
        checkPermissions((oakPath == null) ? null : tree, permissions);
    }
    // check if the tree defines access controlled content
    if (checkAcContent && config.getContext().definesTree(tree)) {
        throw new AccessControlException("Tree " + tree.getPath() + " defines access control content.");
    }
    return tree;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:17,代码来源:AbstractAccessControlManager.java


示例5: testCreateInvalidMvRestriction

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Test
public void testCreateInvalidMvRestriction() throws Exception {
    Map<String, Value[]> invalid = ImmutableMap.of(
            "boolean", new Value[] {vf.createValue(true), vf.createValue(false)},
            "longs", new Value[] {vf.createValue("wrong_type")},
            REP_NT_NAMES, new Value[] {vf.createValue(true)}
    );
    for (String name : invalid.keySet()) {
        try {
            provider.createRestriction("/testPath", name, invalid.get(name));
            fail("invalid restriction " + name);
        } catch (AccessControlException e) {
            // success
        }
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:17,代码来源:CompositeRestrictionProviderTest.java


示例6: setAclManagementCallback

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
/**
 * Create a {@linkplain JcrCallback} for setting up ACL management in test repository
 * 
 * @return acl management callback
 */
static JcrCallback setAclManagementCallback() {
  return new JcrCallback() {
    @Override
    public Object doInJcr( Session session ) throws IOException, RepositoryException {
      PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( session );
      Workspace workspace = session.getWorkspace();
      PrivilegeManager privilegeManager = ( (JackrabbitWorkspace) workspace ).getPrivilegeManager();
      try {
        privilegeManager.getPrivilege( pentahoJcrConstants.getPHO_ACLMANAGEMENT_PRIVILEGE() );
      } catch ( AccessControlException ace ) {
        privilegeManager.registerPrivilege( pentahoJcrConstants.getPHO_ACLMANAGEMENT_PRIVILEGE(), false,
            new String[0] );
      }
      session.save();
      return null;
    }
  };
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:24,代码来源:PurRepositoryTestingUtils.java


示例7: setAclManagement

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
private void setAclManagement() {
  testJcrTemplate.execute( new JcrCallback() {
    @Override
    public Object doInJcr( Session session ) throws IOException, RepositoryException {
      PentahoJcrConstants pentahoJcrConstants = new PentahoJcrConstants( session );
      Workspace workspace = session.getWorkspace();
      PrivilegeManager privilegeManager = ( (JackrabbitWorkspace) workspace ).getPrivilegeManager();
      try {
        privilegeManager.getPrivilege( pentahoJcrConstants.getPHO_ACLMANAGEMENT_PRIVILEGE() );
      } catch ( AccessControlException ace ) {
        privilegeManager.registerPrivilege( pentahoJcrConstants.getPHO_ACLMANAGEMENT_PRIVILEGE(), false,
            new String[0] );
      }
      session.save();
      return null;
    }
  } );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:19,代码来源:UIEERepositoryDirectoryIT.java


示例8: getModifiableAcl

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
public static JackrabbitAccessControlList getModifiableAcl(final AccessControlManager accessManager,
		final String path) throws RepositoryException {
	final JackrabbitAccessControlList acl = getAccessControlList(accessManager, path);
	if (null != acl) {
		return acl;
	}

	final JackrabbitAccessControlList applicableAcl = getApplicableAccessControlList(accessManager, path);
	if (null != applicableAcl) {
		return applicableAcl;
	}

	throw new AccessControlException("No modifiable ACL at " + path);
}
 
开发者ID:Cognifide,项目名称:APM,代码行数:15,代码来源:JackrabbitAccessControlListUtil.java


示例9: validateRestrictions

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Override
public void validateRestrictions(String oakPath, Tree aceTree) throws AccessControlException {
    super.validateRestrictions(oakPath, aceTree);

    Tree restrictionsTree = getRestrictionsTree(aceTree);
    PropertyState glob = restrictionsTree.getProperty(REP_GLOB);
    if (glob != null) {
        GlobPattern.validate(glob.getValue(Type.STRING));
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:11,代码来源:RestrictionProviderImpl.java


示例10: validate

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
static void validate(@Nonnull String restriction) throws AccessControlException {
    int cnt = 0;
    for (int i = 0; i < restriction.length(); i++) {
        if (WILDCARD_CHAR == restriction.charAt(i)) {
            cnt++;
        }
        if (cnt > MAX_WILDCARD) {
            throw new AccessControlException("Number of wildcards in rep:glob exceeds allowed complexity.");
        }
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:12,代码来源:GlobPattern.java


示例11: removeAccessControlEntry

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Override
public void removeAccessControlEntry(AccessControlEntry ace) throws RepositoryException {
    ACE entry = checkACE(ace);
    if (!entries.remove(entry)) {
        throw new AccessControlException("Cannot remove AccessControlEntry " + ace);
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:8,代码来源:ACL.java


示例12: getNodePath

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
private String getNodePath(ACE principalBasedAce) throws RepositoryException {
    Value v = principalBasedAce.getRestriction(REP_NODE_PATH);
    if (v == null) {
        throw new AccessControlException("Missing mandatory restriction rep:nodePath");
    } else {
        return getOakPath(v.getString());
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:9,代码来源:AccessControlManagerImpl.java


示例13: checkValidPrincipal

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
public static void checkValidPrincipal(@Nullable Principal principal,
                                       @Nonnull PrincipalManager principalManager,
                                       boolean verifyExists) throws AccessControlException {
    String name = (principal == null) ? null : principal.getName();
    if (name == null || name.isEmpty()) {
        throw new AccessControlException("Invalid principal " + name);
    }
    if (verifyExists && !(principal instanceof PrincipalImpl) && !principalManager.hasPrincipal(name)) {
        throw new AccessControlException("Unknown principal " + name);
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:12,代码来源:Util.java


示例14: checkValidPrincipals

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
public static void checkValidPrincipals(@Nullable Set<Principal> principals,
                                        @Nonnull PrincipalManager principalManager) throws AccessControlException {
    if (principals == null) {
        throw new AccessControlException("Valid principals expected. Found null.");
    }
    for (Principal principal : principals) {
        checkValidPrincipal(principal, principalManager, true);
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:10,代码来源:Util.java


示例15: getPrivilege

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Override
public Privilege getPrivilege(String privilegeName) throws RepositoryException {
    PrivilegeDefinition def = getPrivilegeDefinition(getOakName(privilegeName));
    if (def == null) {
        throw new AccessControlException("No such privilege " + privilegeName);
    } else {
        return getPrivilege(def);
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:10,代码来源:PrivilegeManagerImpl.java


示例16: getOakName

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Nonnull
private String getOakName(String jcrName) throws RepositoryException {
    if (jcrName == null) {
        throw new AccessControlException("Invalid privilege name 'null'");
    }
    String oakName = namePathMapper.getOakNameOrNull(jcrName);
    if (oakName == null) {
    	throw new AccessControlException("Cannot resolve privilege name " + jcrName);
    }
    return oakName;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:12,代码来源:PrivilegeManagerImpl.java


示例17: asRepositoryException

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
/**
 * Wraps the given {@link CommitFailedException} instance using the
 * appropriate {@link javax.jcr.RepositoryException} subclass based on the
 * {@link CommitFailedException#getType() type} of the given exception.
 *
 * @param message The exception message.
 * @return matching repository exception
 */
public RepositoryException asRepositoryException(@Nonnull String message) {
    if (isConstraintViolation()) {
        return new ConstraintViolationException(message, this);
    } else if (isOfType(NAMESPACE)) {
        return new NamespaceException(message, this);
    } else if (isOfType(NODE_TYPE)) {
        return new NoSuchNodeTypeException(message, this);
    } else if (isAccessViolation()) {
        return new AccessDeniedException(message, this);
    } else if (isAccessControlViolation()) {
        return new AccessControlException(message, this);
    } else if (isOfType(INTEGRITY)) {
        return new ReferentialIntegrityException(message, this);
    } else if (isOfType(STATE)) {
        return new InvalidItemStateException(message, this);
    } else if (isOfType(MERGE)) {
        return new InvalidItemStateException(message, this);
    } else if (isOfType(VERSION)) {
        return new VersionException(message, this);
    } else if (isOfType(LABEL_EXISTS)) {
        return new LabelExistsVersionException(message, this);
    } else if (isOfType(LOCK)) {
        return new LockException(message, this);
    } else if (isOfType(UNSUPPORTED)) {
        return new UnsupportedRepositoryOperationException(message, this);
    } else {
        return new RepositoryException(message, this);
    }
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:38,代码来源:CommitFailedException.java


示例18: getDefinition

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Nonnull
private RestrictionDefinition getDefinition(@Nullable String oakPath, @Nonnull String oakName) throws AccessControlException {
    if (isUnsupportedPath(oakPath)) {
        throw new AccessControlException("Unsupported restriction at " + oakPath);
    }
    RestrictionDefinition definition = supported.get(oakName);
    if (definition == null) {
        throw new AccessControlException("Unsupported restriction: " + oakName);
    }
    return definition;
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:12,代码来源:AbstractRestrictionProvider.java


示例19: getProvider

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
private RestrictionProvider getProvider(@Nullable String oakPath, @Nonnull String oakName) throws AccessControlException {
    for (RestrictionProvider rp : providers) {
        for (RestrictionDefinition def : rp.getSupportedRestrictions(oakPath)) {
            if (def.getName().equals(oakName)) {
                return rp;
            }
        }
    }
    throw new AccessControlException("Unsupported restriction (path = " + oakPath + "; name = " + oakName + ')');
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:11,代码来源:CompositeRestrictionProvider.java


示例20: setPolicy

import javax.jcr.security.AccessControlException; //导入依赖的package包/类
@Override
public void setPolicy(String absPath, AccessControlPolicy policy) throws RepositoryException {
    for (AccessControlManager acMgr : acMgrs) {
        if (acMgr instanceof PolicyOwner && ((PolicyOwner) acMgr).defines(absPath, policy)) {
            acMgr.setPolicy(absPath, policy);
            return;
        }
    }
    throw new AccessControlException("Cannot set access control policy " + policy + "; no PolicyOwner found.");
}
 
开发者ID:denismo,项目名称:jackrabbit-dynamodb-store,代码行数:11,代码来源:CompositeAuthorizationConfiguration.java



注:本文中的javax.jcr.security.AccessControlException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServiceTask类代码示例发布时间:2022-05-22
下一篇:
Java TFloatFloatMap类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap