当前位置: 首页>>代码示例>>Java>>正文


Java AccessPermission.getAccessStatus方法代码示例

本文整理汇总了Java中org.alfresco.service.cmr.security.AccessPermission.getAccessStatus方法的典型用法代码示例。如果您正苦于以下问题:Java AccessPermission.getAccessStatus方法的具体用法?Java AccessPermission.getAccessStatus怎么用?Java AccessPermission.getAccessStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.service.cmr.security.AccessPermission的用法示例。


在下文中一共展示了AccessPermission.getAccessStatus方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSortedACLs

import org.alfresco.service.cmr.security.AccessPermission; //导入方法依赖的package包/类
/**
 * @return Sorted list of <code>AccessPermission</code> based on <code>CMISConnector.AccessPermissionComparator</code>
 *         and <code>AccessStatus</code> of the permission for an authority.
 */
public static List<AccessPermission> getSortedACLs(Set<AccessPermission> acls)
{
    ArrayList<AccessPermission> ordered = new ArrayList<AccessPermission>(acls);
    Map<String, AccessPermission> deDuplicatedPermissions = new HashMap<String, AccessPermission>(acls.size());
    Collections.sort(ordered, new CMISConnector.AccessPermissionComparator());
    for (AccessPermission current : ordered)
    {
        String composedKey = current.getAuthority() + current.getPermission();
        if (current.getAccessStatus() == AccessStatus.ALLOWED)
        {
            deDuplicatedPermissions.put(composedKey, current);
        }
        else if (current.getAccessStatus() == AccessStatus.DENIED)
        {
            deDuplicatedPermissions.remove(composedKey);
        }
    }

    return new ArrayList<AccessPermission>(deDuplicatedPermissions.values());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ScriptNode.java

示例2: getAllowedPermissionsMap

import org.alfresco.service.cmr.security.AccessPermission; //导入方法依赖的package包/类
/**
 * Gets the authorities and their allowed permissions for a node
 */
private Map<String, Set<String>> getAllowedPermissionsMap(NodeRef nodeRef)
{
   Map<String,Set<String>> perms = new HashMap<String, Set<String>>();
   for (AccessPermission ap : permissionService.getAllSetPermissions(nodeRef))
   {
      if (ap.getAccessStatus() == AccessStatus.ALLOWED)
      {
         Set<String> permsValue = perms.get(ap.getAuthority());
         if (permsValue == null)
         {
            permsValue  = new HashSet<String>();
         }
         permsValue.add(ap.getPermission());
         perms.put(ap.getAuthority(), permsValue);
      }
   }
   return perms;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:SiteServiceImplTest.java

示例3: bindPermissions

import org.alfresco.service.cmr.security.AccessPermission; //导入方法依赖的package包/类
/**
 * Bind permissions - binds authorities
 * 
 * @param permissions List<AccessPermission>
 * @return List<AccessPermission>
 */
private List<AccessPermission> bindPermissions(List<AccessPermission> permissions)
{
    List<AccessPermission> boundPermissions = new ArrayList<AccessPermission>(permissions.size());
    
    for (AccessPermission permission : permissions)
    {
        AccessPermission ace = new NodeContext.ACE(permission.getAccessStatus(),
                                                   bindPlaceHolder(permission.getAuthority(), binding),
                                                   permission.getPermission());
        boundPermissions.add(ace);
    }
    
    return boundPermissions;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:ImporterComponent.java

示例4: countGranted

import org.alfresco.service.cmr.security.AccessPermission; //导入方法依赖的package包/类
private int countGranted(Set<AccessPermission> permissions)
{
    int count = 0;
    for (AccessPermission ap : permissions)
    {
        if (ap.getAccessStatus() == AccessStatus.ALLOWED)
        {
            count++;
        }
    }
    return count;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:PermissionServiceTest.java

示例5: setupUserAction

import org.alfresco.service.cmr.security.AccessPermission; //导入方法依赖的package包/类
/**
 * Action event called by all actions that need to setup a Person context on
 * the UserMembers bean before an action page is called. The context will be a
 * Authority in setPersonAuthority() which can be retrieved on the action page from
 * UserMembersBean.setPersonAuthority().
 */
public void setupUserAction(ActionEvent event)
{
   FacesContext context = FacesContext.getCurrentInstance();
   
   UIActionLink link = (UIActionLink) event.getComponent();
   Map<String, String> params = link.getParameterMap();
   String authority = params.get("userName");
   if (authority != null && authority.length() != 0)
   {
      try
      {
         if (this.getPersonService().personExists(authority))
         {
            // create the node ref, then our node representation
            NodeRef ref = getPersonService().getPerson(authority);
            Node node = new Node(ref);
            
            // setup convience function for current user full name
            String firstName = (String)node.getProperties().get(ContentModel.PROP_FIRSTNAME);
            String lastName = (String)node.getProperties().get(ContentModel.PROP_LASTNAME);
            setPersonName((firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : ""));
         }
         else
         {
            String label = params.get("userNameLabel");
            if (label == null || label.length() == 0)
            {
               label = authority;
            }
            
            setPersonName(label);
         }
         
         // setup roles for this Authority
         List<PermissionWrapper> userPermissions = new ArrayList<PermissionWrapper>(4);
         Set<AccessPermission> permissions = getPermissionService().getAllSetPermissions(getNode().getNodeRef());
         if (permissions != null)
         {
            for (AccessPermission permission : permissions)
            {
               // we are only interested in Allow permissions
               if (permission.getAccessStatus() == AccessStatus.ALLOWED)
               {
                  if (authority.equals(permission.getAuthority()))
                  {
                     // found a permission for this user authentiaction
                     PermissionWrapper wrapper = new PermissionWrapper(
                           permission.getPermission(),
                           Application.getMessage(context, permission.getPermission()));
                     userPermissions.add(wrapper);
                  }
               }
            }
         }
         // action context setup
         this.personRolesDataModel = null;
         this.personRoles = userPermissions;
         setPersonAuthority(authority);
      }
      catch (Exception err)
      {
         Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext
               .getCurrentInstance(), Repository.ERROR_GENERIC), new Object[] { err.getMessage() }));
      }
   }
   else
   {
      setPersonAuthority(null);
   }
   
   // force refresh on return to this page
   contextUpdated();
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:80,代码来源:UserMembersBean.java


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