java破解sis_Java Site.getUsersIsAllowed方法代码示例

import org.sakaiproject.site.api.Site; //导入方法依赖的package包/类

/**

* Get the members with the given role.

*

* Sorted by online status then display name. Maximum returned is 30 but can be overridden.

*

* @param siteId the site id to get the members for

* @param role the role we want to get the users for

* @return list of {@link GridPerson} or an empty list if none

*/

final List getMembersWithRole(final Site site, final SiteRole role,

final Set hiddenUserIds) {

List userList = new ArrayList<>();

Set userUuids = site.getUsersIsAllowed(role.getPermissionName());

userUuids.removeAll(hiddenUserIds);

final List users = this.userDirectoryService.getUsers(userUuids);

userList = this.connectionsLogic.getBasicConnections(users);

// sort

Collections.sort(userList, new Comparator() {

@Override

public int compare(final BasicConnection o1, final BasicConnection o2) {

// Here we sort the users by their online status. Annoyingly, the constants are

// 0: offline, 1: online, 2:away, so we can't just sort by that.

return new CompareToBuilder()

.append(o1.getOnlineStatus()==ProfileConstants.ONLINE_STATUS_OFFLINE?2:1,

o2.getOnlineStatus()==ProfileConstants.ONLINE_STATUS_OFFLINE?2:1)

.append(o1.getDisplayName(), o2.getDisplayName())

.toComparison();

}

});

// get slice

userList = userList

.stream()

.limit(this.maxUsers)

.collect(Collectors.toList());

List rval = new ArrayList<>();

for (BasicConnection person : userList) {

GridPerson gridPerson = new GridPerson();

gridPerson.uuid = person.getUuid();

gridPerson.displayName = person.getDisplayName();

gridPerson.role = role.toString();

gridPerson.onlineStatus = person.getOnlineStatus();

rval.add(gridPerson);

}

return rval;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值