public boolean canView(RepositoryModel repository) {\r
return canAccess(repository, AccessRestrictionType.VIEW, AccessPermission.VIEW);\r
}\r
+ \r
+ public boolean canView(RepositoryModel repository, String ref) {\r
+ // Default UserModel doesn't implement ref-level security.\r
+ // Other Realms (i.e. Gerrit) may override this method.\r
+ return canView(repository);\r
+ }\r
\r
public boolean canClone(RepositoryModel repository) {\r
return canAccess(repository, AccessRestrictionType.CLONE, AccessPermission.CLONE);\r
return nameVerified && emailVerified;\r
}\r
\r
+ @Deprecated\r
public boolean hasBranchPermission(String repositoryName, String branch) {\r
// Default UserModel doesn't implement branch-level security. Other Realms (i.e. Gerrit) may override this method.\r
return hasRepositoryPermission(repositoryName) || hasTeamRepositoryPermission(repositoryName);\r
// workaround until get().getUser() is reviewed throughout the app\r
user = UserModel.ANONYMOUS;\r
}\r
- boolean canAccess = user.hasBranchPermission(repositoryName,\r
+ boolean canAccess = user.canView(getRepositoryModel(),\r
branch.reference.getName());\r
if (!canAccess) {\r
error(getString("gb.accessDenied"), true);\r
\r
List<RefModel> localBranches = JGitUtils.getLocalBranches(r, false, -1);\r
for (RefModel refModel : localBranches) {\r
- if (user.hasBranchPermission(model.name, refModel.reference.getName())) {\r
+ if (user.canView(model, refModel.reference.getName())) {\r
branches.add(refModel);\r
}\r
}\r
if (model.showRemoteBranches) {\r
List<RefModel> remoteBranches = JGitUtils.getRemoteBranches(r, false, -1);\r
for (RefModel refModel : remoteBranches) {\r
- if (user.hasBranchPermission(model.name, refModel.reference.getName())) {\r
+ if (user.canView(model, refModel.reference.getName())) {\r
branches.add(refModel);\r
}\r
}\r