| | |
| | | import com.gitblit.PagesServlet;
|
| | | import com.gitblit.SyndicationServlet;
|
| | | import com.gitblit.models.ProjectModel;
|
| | | import com.gitblit.models.RefModel;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.SubmoduleModel;
|
| | | import com.gitblit.models.UserModel;
|
| | |
| | | if (!getRepositoryModel().hasCommits) {
|
| | | setResponsePage(EmptyRepositoryPage.class, params);
|
| | | }
|
| | | |
| | | if (getRepositoryModel().isCollectingGarbage) {
|
| | | error(MessageFormat.format(getString("gb.busyCollectingGarbage"), getRepositoryModel().name), true);
|
| | | }
|
| | |
|
| | | if (objectId != null) {
|
| | | RefModel branch = null;
|
| | | if ((branch = JGitUtils.getBranch(getRepository(), objectId)) != null) {
|
| | | UserModel user = GitBlitWebSession.get().getUser();
|
| | | if (user == null) {
|
| | | // workaround until get().getUser() is reviewed throughout the app
|
| | | user = UserModel.ANONYMOUS;
|
| | | }
|
| | | boolean canAccess = user.canView(getRepositoryModel(),
|
| | | branch.reference.getName());
|
| | | if (!canAccess) {
|
| | | error(getString("gb.accessDenied"), true);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // register the available page links for this page and user
|
| | | registeredPages = registerPages();
|
| | |
| | | pages.put("branches", new PageRegistration("gb.branches", BranchesPage.class, params));
|
| | | pages.put("tags", new PageRegistration("gb.tags", TagsPage.class, params));
|
| | | pages.put("tree", new PageRegistration("gb.tree", TreePage.class, params));
|
| | | pages.put("forks", new PageRegistration("gb.forks", ForksPage.class, params));
|
| | | if (GitBlit.getBoolean(Keys.web.allowForking, true)) {
|
| | | pages.put("forks", new PageRegistration("gb.forks", ForksPage.class, params));
|
| | | }
|
| | |
|
| | | // conditional links
|
| | | Repository r = getRepository();
|
| | |
| | | }
|
| | |
|
| | | protected boolean allowForkControls() {
|
| | | return true;
|
| | | return GitBlit.getBoolean(Keys.web.allowForking, true);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | RepositoryModel model = GitBlit.self().getRepositoryModel(
|
| | | GitBlitWebSession.get().getUser(), repositoryName);
|
| | | if (model == null) {
|
| | | if (GitBlit.self().hasRepository(repositoryName)) {
|
| | | if (GitBlit.self().hasRepository(repositoryName, true)) {
|
| | | // has repository, but unauthorized
|
| | | authenticationError(getString("gb.unauthorizedAccessForRepository") + " " + repositoryName);
|
| | | } else {
|
| | |
| | | }
|
| | |
|
| | | protected String getShortObjectId(String objectId) {
|
| | | return objectId.substring(0, 8);
|
| | | return objectId.substring(0, GitBlit.getInteger(Keys.web.shortCommitIdLength, 6));
|
| | | }
|
| | |
|
| | | protected void addRefs(Repository r, RevCommit c) {
|
| | |
| | | Constants.SearchType searchType) {
|
| | | String name = identity == null ? "" : identity.getName();
|
| | | String address = identity == null ? "" : identity.getEmailAddress();
|
| | | name = StringUtils.removeNewlines(name);
|
| | | address = StringUtils.removeNewlines(address);
|
| | | boolean showEmail = GitBlit.getBoolean(Keys.web.showEmailAddresses, false);
|
| | | if (!showEmail || StringUtils.isEmpty(name) || StringUtils.isEmpty(address)) {
|
| | | String value = name;
|
| | |
| | | getRequestCycle().setRequestTarget(new RedirectRequestTarget(absoluteUrl));
|
| | | }
|
| | | }
|
| | | } |
| | | }
|