@Override
protected Collection<UserData> getUsers() {
try {
final PermissionChecker oldChecker = PermissionThreadLocal.getPermissionChecker();
try {
PermissionThreadLocal.setPermissionChecker(new PermissionChecker() { //TODO not the best way to do it?
@Override
public long getCompanyId() {
return oldChecker.getCompanyId();
}
@Override
public long getOwnerRoleId() {
return oldChecker.getOwnerRoleId();
}
@Override
public long[] getRoleIds(long userId, long groupId) {
return oldChecker.getRoleIds(userId, groupId);
}
@Override
public long getUserId() {
return oldChecker.getUserId();
}
@Override
public boolean hasOwnerPermission(long companyId, String name, long primKey, long ownerId, String actionId) {
return true;
}
@Override
public boolean hasOwnerPermission(long companyId, String name, String primKey, long ownerId, String actionId) {
return true;
}
@Override
public boolean hasPermission(long groupId, String name, long primKey, String actionId) {
return true;
}
@Override
public boolean hasPermission(long groupId, String name, String primKey, String actionId) {
return true;
}
@Override
public boolean hasUserPermission(long groupId, String name, String primKey, String actionId, boolean checkAdmin) {
return true;
}
@Override
public void init(User user, boolean checkGuest) {
oldChecker.init(user, checkGuest);
}
@Override
public boolean isCommunityAdmin(long groupId) {
return true;
}
@Override
public boolean isCommunityOwner(long groupId) {
return true;
}
@Override
public boolean isCompanyAdmin() {
return true;
}
@Override
public boolean isCompanyAdmin(long companyId) {
return true;
}
@Override
public boolean isOmniadmin() {
return true;
}
@Override
public void resetValues() {
oldChecker.resetValues();
}
@Override
public void setCheckGuest(boolean checkGuest) {
oldChecker.setCheckGuest(true);
}
@Override
public void setValues(PortletRequest portletRequest) {
oldChecker.setValues(portletRequest);
}
});
Role role = RoleServiceUtil.getRole(PortalUtil.getDefaultCompanyId(), liferayRoleName);
if (role == null) return new HashSet<UserData>();
long[] roleUserIds = UserServiceUtil.getRoleUserIds(role.getRoleId());