Set<RegistrantAccessPermission> set = new LinkedHashSet<RegistrantAccessPermission>();
set.addAll(user.getRepositoryPermissions());
// Flag missing repositories
for (RegistrantAccessPermission permission : set) {
if (permission.mutable && PermissionType.EXPLICIT.equals(permission.permissionType)) {
RepositoryModel rm = getRepository(permission.registrant);
if (rm == null) {
permission.permissionType = PermissionType.MISSING;
permission.mutable = false;
continue;
}
}
}
// TODO reconsider ownership as a user property
// manually specify personal repository ownerships
for (RepositoryModel rm : allRepositories) {
if (rm.isUsersPersonalRepository(user.username) || rm.isOwner(user.username)) {
RegistrantAccessPermission rp = new RegistrantAccessPermission(rm.name, AccessPermission.REWIND,
PermissionType.OWNER, RegistrantType.REPOSITORY, null, false);
// user may be owner of a repository to which they've inherited
// a team permission, replace any existing perm with owner perm
set.remove(rp);