本文整理汇总了Java中org.alfresco.repo.security.authority.UnknownAuthorityException类的典型用法代码示例。如果您正苦于以下问题:Java UnknownAuthorityException类的具体用法?Java UnknownAuthorityException怎么用?Java UnknownAuthorityException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnknownAuthorityException类属于org.alfresco.repo.security.authority包,在下文中一共展示了UnknownAuthorityException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllRootGroupsInZone
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
/**
* Get the root groups, those without a parent group.
* @param zone zone to search in.
* @param maxItems Maximum number of items returned.
* @param skipCount number of items to skip.
* @return The root groups (empty if there are no root groups)
*/
public ScriptGroup[] getAllRootGroupsInZone(String zone, int maxItems, int skipCount)
{
Set<String> authorities;
try
{
authorities= authorityService.getAllRootAuthoritiesInZone(zone, AuthorityType.GROUP);
}
catch(UnknownAuthorityException e)
{
authorities = Collections.emptySet();
}
return makeScriptGroups(authorities, new ScriptPagingDetails(maxItems, skipCount),
null, serviceRegistry, this.getScope());
}
示例2: searchGroupsInZone
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
/**
* Search for groups in a specific zone
* Includes paging parameters to limit size of results returned.
*
* @param shortNameFilter partial match on shortName (* and ?) work. If empty then matches everything.
* @param zone zone to search in.
* @param paging Paging object with max number to return, and items to skip
* @param sortBy What to sort on (authorityName, shortName or displayName)
* @return the groups matching the query
*/
public ScriptGroup[] searchGroupsInZone(String shortNameFilter, String zone, ScriptPagingDetails paging, String sortBy)
{
String filter = shortNameFilter;
if (shortNameFilter.length() != 0)
{
filter = filter.replace("\"", "");
}
Set<String> authorities;
try
{
authorities = authorityService.findAuthorities(AuthorityType.GROUP, null, false, filter, zone);
}
catch(UnknownAuthorityException e)
{
// Return an empty set if unrecognised authority.
authorities = Collections.emptySet();
}
return makeScriptGroups(authorities, paging, sortBy, serviceRegistry, this.getScope());
}
示例3: getAuthoritiesInfo
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
private PagingResults<AuthorityInfo> getAuthoritiesInfo(AuthorityType authorityType, String groupId, Pair<String, Boolean> sortProp, Paging paging)
{
Set<String> authorities;
try
{
authorities = authorityService.findAuthorities(authorityType, groupId, true, null, null);
}
catch (UnknownAuthorityException e)
{
authorities = Collections.emptySet();
}
List<AuthorityInfo> authorityInfoList = new ArrayList<>(authorities.size());
authorityInfoList.addAll(authorities.stream().map(this::getAuthorityInfo).collect(Collectors.toList()));
// Post process sorting - this should be moved to service
// layer. It is done here because sorting is not supported at
// service layer.
AuthorityInfoComparator authorityComparator = new AuthorityInfoComparator(sortProp.getFirst(), sortProp.getSecond());
Collections.sort(authorityInfoList, authorityComparator);
// Post process paging - this should be moved to service layer.
return Util.wrapPagingResults(paging, authorityInfoList);
}
示例4: searchRootGroupsInZone
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
/**
* Search the root groups, those without a parent group.
*
* @param paging Paging object with max number to return, and items to skip
* @param sortBy What to sort on (authorityName, shortName or displayName)
* @return The root groups (empty if there are no root groups)
*/
public ScriptGroup[] searchRootGroupsInZone(String displayNamePattern, String zone, ScriptPagingDetails paging, String sortBy)
{
Set<String> authorities;
try
{
authorities = authorityService.findAuthorities(AuthorityType.GROUP,
null, true, displayNamePattern, zone);
}
catch (UnknownAuthorityException e)
{
authorities = Collections.emptySet();
}
return makeScriptGroups(authorities, paging, sortBy, serviceRegistry, this.getScope());
}
示例5: getAllRootGroups
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
/**
* Search the root groups, those without a parent group. Searches in all zones.
* @return The root groups (empty if there are no root groups)
*/
public ScriptGroup[] getAllRootGroups(ScriptPagingDetails paging)
{
Set<String> authorities;
try
{
authorities = authorityService.getAllRootAuthorities(AuthorityType.GROUP);
}
catch(UnknownAuthorityException e)
{
authorities = Collections.emptySet();
}
return makeScriptGroups(authorities, paging, serviceRegistry, this.getScope());
}
示例6: getAllRootAuthorities
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
private Set<String> getAllRootAuthorities(AuthorityType authorityType)
{
Set<String> authorities;
try
{
authorities = authorityService.getAllRootAuthorities(authorityType);
}
catch (UnknownAuthorityException e)
{
authorities = Collections.emptySet();
}
return authorities;
}
示例7: updateSiteMember
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
public SiteMember updateSiteMember(String siteId, SiteMember siteMember)
{
String siteMemberId = siteMember.getPersonId();
if(siteMemberId == null)
{
throw new InvalidArgumentException("Member id is null");
}
siteMemberId = people.validatePerson(siteMemberId);
SiteInfo siteInfo = validateSite(siteId);
if(siteInfo == null)
{
// site does not exist
throw new EntityNotFoundException(siteId);
}
siteId = siteInfo.getShortName();
String siteRole = siteMember.getRole();
if(siteRole == null)
{
throw new InvalidArgumentException("Must provide a role");
}
/* MNT-10551 : fix */
if (!siteService.isMember(siteId, siteMember.getPersonId()))
{
throw new InvalidArgumentException("User is not a member of the site");
}
try
{
siteService.setMembership(siteId, siteMember.getPersonId(), siteRole);
}
catch (UnknownAuthorityException e)
{
throw new InvalidArgumentException("Unknown role '" + siteRole + "'");
}
return siteMember;
}
示例8: getGroupsInZone
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
/**
* Retrieves groups matching the given filter from the given zone.
*
* NOTE: If the filter is null, an empty string or * all groups found will be returned.
*
* @param filter Pattern to filter groups by
* @param zone The zone in which to search for groups
* @param paging Paging details
* @param sortBy Field to sort by, can be <code>shortName</code>, <code>displayName</code> or
* <code>authorityName</code>, the default is displayName
* @param sortAsc sort ascending or not
* @return Array of matching groups
* @since 4.1.4
*/
public ScriptGroup[] getGroupsInZone(String filter, String zone, ScriptPagingDetails paging, String sortBy, boolean sortAsc)
{
if (sortBy == null)
{
sortBy = "displayName";
}
if (logger.isDebugEnabled())
{
logger.debug("Start getGroupsInZone("+(filter == null ? "null" : '"'+filter+'"')+", "+zone+", {"+paging.getMaxItems()+" "+paging.getSkipCount()+"}, "+sortBy+")");
}
// reset filter if necessary
if (filter != null && (filter.length() == 0 || filter.equals("*")))
{
filter = null;
}
ScriptGroup[] scriptGroups = null;
try
{
// for backwards compatibility request a total count of found items, once the UI can deal with
// results that do not specify the total number of results this can be removed
paging.setRequestTotalCountMax(10000);
// get the paged results (NOTE: we can only sort by display name currently)
PagingResults<AuthorityInfo> groups = authorityService.getAuthoritiesInfo(AuthorityType.GROUP, zone, filter, sortBy, sortAsc, paging);
// create ScriptGroup array from paged results
scriptGroups = makeScriptGroupsInfo(groups, paging, sortBy, sortAsc, serviceRegistry, this.getScope());
}
catch (UnknownAuthorityException e)
{
scriptGroups = new ScriptGroup[] {};
}
if (logger.isDebugEnabled())
{
logger.debug("End getGroupsInZone("+(filter == null ? "null" : '"'+filter+'"')+", "+zone+", {"+paging.getMaxItems()+" "+paging.getSkipCount()+"}, "+sortBy+") returns "+scriptGroups.length+"\n");
}
return scriptGroups;
}
示例9: getGroups
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
public CollectionWithPagingInfo<Group> getGroups(final Parameters parameters)
{
final List<String> includeParam = parameters.getInclude();
Paging paging = parameters.getPaging();
// Retrieve sort column. This is limited for now to sort column due to
// v0 api implementation. Should be improved in the future.
Pair<String, Boolean> sortProp = getGroupsSortProp(parameters);
// Parse where clause properties.
Query q = parameters.getQuery();
Boolean isRootParam = null;
String zoneFilter = null;
if (q != null)
{
GroupsQueryWalker propertyWalker = new GroupsQueryWalker();
QueryHelper.walk(q, propertyWalker);
isRootParam = propertyWalker.getIsRoot();
List<String> zonesParam = propertyWalker.getZones();
if (zonesParam != null)
{
validateZonesParam(zonesParam);
zoneFilter = zonesParam.get(0);
}
}
final AuthorityType authorityType = AuthorityType.GROUP;
final Set<String> rootAuthorities = getAllRootAuthorities(authorityType);
PagingResults<AuthorityInfo> pagingResult;
try
{
pagingResult = getAuthoritiesInfo(authorityType, isRootParam, zoneFilter, rootAuthorities, sortProp, paging);
}
catch (UnknownAuthorityException e)
{
// Non-existent zone
pagingResult = new EmptyPagingResults<>();
}
// Create response.
final List<AuthorityInfo> page = pagingResult.getPage();
int totalItems = pagingResult.getTotalResultCount().getFirst();
List<Group> groups = new AbstractList<Group>()
{
@Override
public Group get(int index)
{
AuthorityInfo authorityInfo = page.get(index);
return getGroup(authorityInfo, includeParam, rootAuthorities);
}
@Override
public int size()
{
return page.size();
}
};
return CollectionWithPagingInfo.asPaged(paging, groups, pagingResult.hasMoreItems(), totalItems);
}
示例10: addSiteMember
import org.alfresco.repo.security.authority.UnknownAuthorityException; //导入依赖的package包/类
public SiteMember addSiteMember(String siteId, SiteMember siteMember)
{
String personId = people.validatePerson(siteMember.getPersonId());
SiteInfo siteInfo = validateSite(siteId);
if(siteInfo == null)
{
// site does not exist
logger.debug("addSiteMember: site does not exist "+siteId+ " person "+personId);
throw new EntityNotFoundException(siteId);
}
// set the site id to the short name (to deal with case sensitivity issues with using the siteId from the url)
siteId = siteInfo.getShortName();
String role = siteMember.getRole();
if(role == null)
{
logger.debug("addSiteMember: Must provide a role "+siteMember);
throw new InvalidArgumentException("Must provide a role");
}
if(siteService.isMember(siteId, personId))
{
logger.debug("addSiteMember: "+ personId + " is already a member of site " + siteId);
throw new ConstraintViolatedException(personId + " is already a member of site " + siteId);
}
if(!siteService.canAddMember(siteId, personId, role))
{
logger.debug("addSiteMember: PermissionDeniedException "+siteId+ " person "+personId+ " role "+role);
throw new PermissionDeniedException();
}
try
{
siteService.setMembership(siteId, personId, role);
}
catch (UnknownAuthorityException e)
{
logger.debug("addSiteMember: UnknownAuthorityException "+siteId+ " person "+personId+ " role "+role);
throw new InvalidArgumentException("Unknown role '" + role + "'");
}
return siteMember;
}