import com.gitblit.SyndicationServlet;\r
import com.gitblit.models.RefModel;\r
import com.gitblit.models.RepositoryModel;\r
+import com.gitblit.models.UserModel;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.pages.BranchesPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
\r
// branches\r
List<RefModel> branches = new ArrayList<RefModel>();\r
- branches.addAll(JGitUtils.getLocalBranches(r, false, maxCount));\r
+ UserModel user = GitBlitWebSession.get().getUser();\r
+\r
+ List<RefModel> localBranches = JGitUtils.getLocalBranches(r, false, maxCount);\r
+ for (RefModel refModel : localBranches) {\r
+ if (user.hasBranchPermission(model.name, refModel.reference.getName())) {\r
+ branches.add(refModel);\r
+ }\r
+ }\r
if (model.showRemoteBranches) {\r
- branches.addAll(JGitUtils.getRemoteBranches(r, false, maxCount));\r
+ List<RefModel> remoteBranches = JGitUtils.getRemoteBranches(r, false, maxCount);\r
+ for (RefModel refModel : remoteBranches) {\r
+ if (user.hasBranchPermission(model.name, refModel.reference.getName())) {\r
+ branches.add(refModel);\r
+ }\r
+ }\r
}\r
Collections.sort(branches);\r
Collections.reverse(branches);\r