本文整理汇总了Java中org.alfresco.service.cmr.security.AccessPermission.getPermission方法的典型用法代码示例。如果您正苦于以下问题:Java AccessPermission.getPermission方法的具体用法?Java AccessPermission.getPermission怎么用?Java AccessPermission.getPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.security.AccessPermission
的用法示例。
在下文中一共展示了AccessPermission.getPermission方法的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());
}
示例2: mapAccessPermissionsByName
import org.alfresco.service.cmr.security.AccessPermission; //导入方法依赖的package包/类
private Map<String, List<AccessPermission>> mapAccessPermissionsByName(Set<AccessPermission> accessPermissions)
{
Map<String, List<AccessPermission>> nameMap = new HashMap<>();
for (AccessPermission accessPermission : accessPermissions)
{
String name = accessPermission.getPermission();
List<AccessPermission> permissions = (List<AccessPermission>) nameMap.get(name);
if (permissions == null)
{
permissions = new ArrayList<>();
nameMap.put(name,
permissions);
}
permissions.add(accessPermission);
}
return nameMap;
}
示例3: getCapabilitiesImpl
import org.alfresco.service.cmr.security.AccessPermission; //导入方法依赖的package包/类
/**
*
* @param rmRootNode
* @param roleAuthority
* @return
*/
private Set<Capability> getCapabilitiesImpl(NodeRef rmRootNode, String roleAuthority)
{
Set<AccessPermission> permissions = permissionService.getAllSetPermissions(rmRootNode);
Set<Capability> capabilities = new HashSet<Capability>(52);
for (AccessPermission permission : permissions)
{
if (permission.getAuthority().equals(roleAuthority))
{
String capabilityName = permission.getPermission();
Capability capability = capabilityService.getCapability(capabilityName);
if (capability != null && !capability.isPrivate())
{
capabilities.add(capability);
}
}
}
return capabilities;
}
示例4: 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;
}
示例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();
}