org.nuxeo.ecm.core.api.security.ACE.builder()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.nuxeo.ecm.core.api.security.ACE.builder()方法的一些代码示例,展示了ACE.builder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ACE.builder()方法的具体详情如下:
包路径:org.nuxeo.ecm.core.api.security.ACE
类名称:ACE
方法名:builder

ACE.builder介绍

暂无

代码示例

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

@Override
public boolean blockInheritance(String username) {
  boolean aclChanged = false;
  List<ACE> aces = Lists.newArrayList(getACEs());
  if (!aces.contains(ACE.BLOCK)) {
    aces.add(ACE.builder(username, SecurityConstants.EVERYTHING).creator(username).build());
    aces.addAll(getAdminEverythingACES());
    aces.add(ACE.BLOCK);
    aclChanged = true;
    setACEs(aces.toArray(new ACE[aces.size()]));
  }
  return aclChanged;
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-api

boolean isGranted = Boolean.parseBoolean(parts[2]);
ACEBuilder builder = ACE.builder(username, permission).isGranted(isGranted);

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-io

end.setTimeInMillis(date.getTime());
ACE ace = ACE.builder(username, permission)
       .isGranted(Boolean.parseBoolean(grant))
       .creator(creator)

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core

Map<String, Serializable> contextData = new HashMap<>();
contextData.put(CHANGED_ACL_NAME, aclName);
ACE ace = ACE.builder(username, permission)
    .isGranted(grant)
    .creator(creator)

代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core

protected void replacePermission(DocumentModel doc) {
  Map<String, Serializable> contextData = new HashMap<>();
  contextData.put(NOTIFY_KEY, notify);
  contextData.put(COMMENT_KEY, comment);
  ACE oldACE = ACE.fromId(id);
  ACE newACE = ACE.builder(user, permission)
          .creator(session.getPrincipal().getName())
          .begin(begin)
          .end(end)
          .contextData(contextData)
          .build();
  session.replaceACE(doc.getRef(), aclName, oldACE, newACE);
}

代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core

protected void addPermission(DocumentModel doc) {
  ACP acp = doc.getACP() != null ? doc.getACP() : new ACPImpl();
  Map<String, Serializable> contextData = new HashMap<>();
  contextData.put(NOTIFY_KEY, notify);
  contextData.put(COMMENT_KEY, comment);
  String creator = session.getPrincipal().getName();
  boolean permissionChanged = false;
  if (blockInheritance) {
    permissionChanged = acp.blockInheritance(aclName, creator);
  }
  for (String username : users) {
    ACE ace = ACE.builder(username, permission)
           .creator(creator)
           .begin(begin)
           .end(end)
           .contextData(contextData)
           .build();
    permissionChanged = acp.addACE(aclName, ace) || permissionChanged;
  }
  if (permissionChanged) {
    doc.setACP(acp, true);
  }
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-storage-sql

protected static ACP aclRowsToACP(ACLRow[] acls) {
  ACP acp = new ACPImpl();
  ACL acl = null;
  String name = null;
  for (ACLRow aclrow : acls) {
    if (!aclrow.name.equals(name)) {
      if (acl != null) {
        acp.addACL(acl);
      }
      name = aclrow.name;
      acl = new ACLImpl(name);
    }
    // XXX should prefix user/group
    String user = aclrow.user;
    if (user == null) {
      user = aclrow.group;
    }
    acl.add(ACE.builder(user, aclrow.permission)
          .isGranted(aclrow.grant)
          .creator(aclrow.creator)
          .begin(aclrow.begin)
          .end(aclrow.end)
          .build());
  }
  if (acl != null) {
    acp.addACL(acl);
  }
  return acp;
}

代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core

/**
 * @param acp The ACP to modify
 * @param aclName the name of the ACL to target
 * @param userName the name of the principal (user or group)
 * @param permission the permission of the ACE
 * @param blockInheritance should we block inheritance
 * @param currentPrincipalName the creator
 * @param begin the begin date of the ACE
 * @param end the end date of the ACE
 * @return true if something has changed on the document security
 * @since 7.4
 */
public static boolean addPermission(ACP acp, String aclName, String userName, String permission,
    boolean blockInheritance, String currentPrincipalName, Calendar begin, Calendar end,
    Map<String, Serializable> contextData) {
  boolean acpChanged = false;
  if (blockInheritance) {
    acpChanged = acp.blockInheritance(aclName, currentPrincipalName);
  }
  acpChanged = acpChanged || acp.addACE(aclName,
      ACE.builder(userName, permission)
        .creator(currentPrincipalName)
        .begin(begin)
        .end(end)
        .contextData(contextData)
        .build());
  return acpChanged;
}

代码示例来源:origin: org.nuxeo.ecm.routing/nuxeo-routing-core

@Override
public void run() {
  for (DocumentModel doc : docs) {
    ACP acp = doc.getACP();
    acp.removeACL(aclName);
    ACL acl = new ACLImpl(aclName);
    for (String actorId : actorIds) {
      acl.add(ACE.builder(actorId, permission).creator(ACTOR_ACE_CREATOR).build());
    }
    acp.addACL(0, acl); // add first to get before blocks
    doc.setACP(acp, true);
    session.saveDocument(doc);
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-invite

contextData.put("comment", doc.getPropertyValue("registration:comment"));
acp.addACE(ACL.LOCAL_ACL,
    ACE.builder(targetPrincipal.getName(), (String) doc.getPropertyValue("docinfo:permission"))
      .creator((String) doc.getPropertyValue("docinfo:creator"))
      .contextData(contextData)

相关文章