| | |
| | |
|
| | | public abstract class RepositoryPage extends BasePage {
|
| | |
|
| | | protected final String projectName;
|
| | | protected final String repositoryName;
|
| | | protected final String objectId;
|
| | |
|
| | |
| | | private Map<String, SubmoduleModel> submodules;
|
| | |
|
| | | private final Map<String, PageRegistration> registeredPages;
|
| | |
|
| | | private boolean showAdmin;
|
| | | private boolean isOwner;
|
| | | |
| | | public RepositoryPage(PageParameters params) {
|
| | | super(params);
|
| | | repositoryName = WicketUtils.getRepositoryName(params);
|
| | | if (repositoryName.indexOf('/') > -1) {
|
| | | projectName = repositoryName.substring(0, repositoryName.indexOf('/'));
|
| | | } else {
|
| | | projectName = GitBlit.getString(Keys.web.repositoryRootGroupName, "main");
|
| | | }
|
| | | objectId = WicketUtils.getObject(params);
|
| | |
|
| | | if (StringUtils.isEmpty(repositoryName)) {
|
| | |
| | |
|
| | | // standard links
|
| | | pages.put("repositories", new PageRegistration("gb.repositories", RepositoriesPage.class));
|
| | | pages.put("project", new PageRegistration("gb.project", ProjectPage.class, WicketUtils.newProjectParameter(projectName)));
|
| | | pages.put("summary", new PageRegistration("gb.summary", SummaryPage.class, params));
|
| | | pages.put("log", new PageRegistration("gb.log", LogPage.class, params));
|
| | | pages.put("branches", new PageRegistration("gb.branches", BranchesPage.class, params));
|
| | |
| | | }
|
| | |
|
| | | // Conditionally add edit link
|
| | | final boolean showAdmin;
|
| | | showAdmin = false;
|
| | | if (GitBlit.getBoolean(Keys.web.authenticateAdminPages, true)) {
|
| | | boolean allowAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
|
| | | showAdmin = allowAdmin && GitBlitWebSession.get().canAdmin();
|
| | | } else {
|
| | | showAdmin = GitBlit.getBoolean(Keys.web.allowAdministration, false);
|
| | | }
|
| | | if (showAdmin
|
| | | || GitBlitWebSession.get().isLoggedIn()
|
| | | isOwner = GitBlitWebSession.get().isLoggedIn()
|
| | | && (model.owner != null && model.owner.equalsIgnoreCase(GitBlitWebSession.get()
|
| | | .getUsername()))) {
|
| | | .getUsername()));
|
| | | if (showAdmin || isOwner) {
|
| | | pages.put("edit", new PageRegistration("gb.edit", EditRepositoryPage.class, params));
|
| | | }
|
| | | return pages;
|
| | |
| | | return WicketUtils.newObjectParameter(repositoryName, commitId);
|
| | | }
|
| | |
|
| | | public boolean isShowAdmin() {
|
| | | return showAdmin;
|
| | | }
|
| | | |
| | | public boolean isOwner() {
|
| | | return isOwner;
|
| | | }
|
| | | |
| | | private class SearchForm extends SessionlessForm<Void> implements Serializable {
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|