import com.gitblit.Constants;\r
import com.gitblit.Constants.AccessRestrictionType;\r
import com.gitblit.Constants.AuthorizationControl;\r
+import com.gitblit.Constants.RegistrantType;\r
import com.gitblit.GitBlitException.ForbiddenException;\r
import com.gitblit.GitBlitException.NotAllowedException;\r
import com.gitblit.GitBlitException.UnauthorizedException;\r
return usernames;\r
}\r
\r
- public List<RegistrantAccessPermission> getUserAccessPermissions(RepositoryModel repository) throws IOException {\r
- return RpcUtils.getRepositoryMemberPermissions(repository, url, account, password);\r
+ public List<RegistrantAccessPermission> getUserAccessPermissions(RepositoryModel repository) {\r
+ List<RegistrantAccessPermission> list = new ArrayList<RegistrantAccessPermission>();\r
+ for (UserModel user : allUsers) {\r
+ if (user.hasRepositoryPermission(repository.name)) {\r
+ list.add(new RegistrantAccessPermission(user.username, user.permissions.get(repository.name), RegistrantType.USER));\r
+ }\r
+ }\r
+ return list;\r
}\r
\r
public boolean setUserAccessPermissions(RepositoryModel repository, List<RegistrantAccessPermission> permissions) throws IOException {\r
return teamnames;\r
}\r
\r
- public List<RegistrantAccessPermission> getTeamAccessPermissions(RepositoryModel repository) throws IOException {\r
- return RpcUtils.getRepositoryTeamPermissions(repository, url, account, password);\r
+ public List<RegistrantAccessPermission> getTeamAccessPermissions(RepositoryModel repository) {\r
+ List<RegistrantAccessPermission> list = new ArrayList<RegistrantAccessPermission>();\r
+ for (TeamModel team : allTeams) {\r
+ if (team.hasRepositoryPermission(repository.name)) {\r
+ list.add(new RegistrantAccessPermission(team.name, team.permissions.get(repository.name), RegistrantType.TEAM));\r
+ }\r
+ }\r
+ return list;\r
}\r
\r
public boolean setTeamAccessPermissions(RepositoryModel repository, List<RegistrantAccessPermission> permissions) throws IOException {\r
repository);\r
dialog.setLocationRelativeTo(RepositoriesPanel.this);\r
List<String> usernames = gitblit.getUsernames();\r
- try {\r
- List<RegistrantAccessPermission> members = gitblit.getUserAccessPermissions(repository);\r
- dialog.setUsers(repository.owner, usernames, members);\r
- dialog.setTeams(gitblit.getTeamnames(), gitblit.getTeamAccessPermissions(repository));\r
- dialog.setRepositories(gitblit.getRepositories());\r
- } catch (IOException e) {\r
- // TODO\r
- }\r
+ List<RegistrantAccessPermission> members = gitblit.getUserAccessPermissions(repository);\r
+ dialog.setUsers(repository.owner, usernames, members);\r
+ dialog.setTeams(gitblit.getTeamnames(), gitblit.getTeamAccessPermissions(repository));\r
+ dialog.setRepositories(gitblit.getRepositories());\r
dialog.setFederationSets(gitblit.getFederationSets(), repository.federationSets);\r
List<String> allLocalBranches = new ArrayList<String>();\r
allLocalBranches.add(Constants.DEFAULT_BRANCH);\r