MetaProject metaProject = mpm.getMetaProject();
ProjectInstance projectInstance = metaProject.getProject(projectId.getId());
Set<GroupOperation> groupOperations = projectInstance.getAllowedGroupOperations();
List<UserSharingSetting> result = new ArrayList<UserSharingSetting>();
Set<User> usersWithPermissionsOnProject = new HashSet<User>();
SharingSetting defaultSharingSetting = SharingSetting.getDefaultSharingSetting();
for (GroupOperation groupOperation : groupOperations) {
if (!isWorld(groupOperation.getAllowedGroup())) {
usersWithPermissionsOnProject.addAll(groupOperation.getAllowedGroup().getMembers());
}
else {
defaultSharingSetting = getSharingSettingFromOperations(groupOperation.getAllowedOperations());
}
}
for (User user : usersWithPermissionsOnProject) {
Collection<Operation> operations = mpm.getAllowedOperations(projectId.getId(), user.getName());
SharingSetting sharingSetting = getSharingSettingFromOperations(operations);
UserSharingSetting userSharingSetting = new UserSharingSetting(UserId.getUserId(user.getName()), sharingSetting);
result.add(userSharingSetting);
}
Collections.sort(result);