| | |
| | | // personal create permissions, inject personal repository path
|
| | | model.name = user.getPersonalPath() + "/";
|
| | | model.projectPath = user.getPersonalPath();
|
| | | model.owner = user.username;
|
| | | model.addOwner(user.username);
|
| | | // personal repositories are private by default
|
| | | model.accessRestriction = AccessRestrictionType.VIEW;
|
| | | model.authorizationControl = AuthorizationControl.NAMED;
|
| | |
| | | repositoryUsers.addAll(GitBlit.self().getUserAccessPermissions(repositoryModel));
|
| | | repositoryTeams.addAll(GitBlit.self().getTeamAccessPermissions(repositoryModel));
|
| | | Collections.sort(repositoryUsers);
|
| | | Collections.sort(repositoryTeams);
|
| | |
|
| | | federationSets.addAll(repositoryModel.federationSets);
|
| | | if (!ArrayUtils.isEmpty(repositoryModel.indexedBranches)) {
|
| | |
| | | final RegistrantPermissionsPanel teamsPalette = new RegistrantPermissionsPanel("teams",
|
| | | RegistrantType.TEAM, GitBlit.self().getAllTeamnames(), repositoryTeams, getAccessPermissions());
|
| | |
|
| | | // owners palette
|
| | | List<String> owners = new ArrayList<String>(repositoryModel.owners);
|
| | | List<String> persons = GitBlit.self().getAllUsernames();
|
| | | final Palette<String> ownersPalette = new Palette<String>("owners", new ListModel<String>(owners), new CollectionModel<String>(
|
| | | persons), new StringChoiceRenderer(), 12, true);
|
| | | |
| | | // indexed local branches palette
|
| | | List<String> allLocalBranches = new ArrayList<String>();
|
| | | allLocalBranches.add(Constants.DEFAULT_BRANCH);
|
| | |
| | | }
|
| | | repositoryModel.indexedBranches = indexedBranches;
|
| | |
|
| | | // owners
|
| | | repositoryModel.owners.clear();
|
| | | Iterator<String> owners = ownersPalette.getSelectedChoices();
|
| | | while (owners.hasNext()) {
|
| | | repositoryModel.addOwner(owners.next());
|
| | | }
|
| | | |
| | | // pre-receive scripts
|
| | | List<String> preReceiveScripts = new ArrayList<String>();
|
| | | Iterator<String> pres = preReceivePalette.getSelectedChoices();
|
| | |
| | | // field names reflective match RepositoryModel fields
|
| | | form.add(new TextField<String>("name").setEnabled(allowEditName));
|
| | | form.add(new TextField<String>("description"));
|
| | | form.add(new DropDownChoice<String>("owner", GitBlit.self().getAllUsernames())
|
| | | .setEnabled(GitBlitWebSession.get().canAdmin()));
|
| | | form.add(new CheckBox("allowForks"));
|
| | | form.add(ownersPalette);
|
| | | form.add(new CheckBox("allowForks").setEnabled(GitBlit.getBoolean(Keys.web.allowForking, true)));
|
| | | DropDownChoice<AccessRestrictionType> accessRestriction = new DropDownChoice<AccessRestrictionType>("accessRestriction", Arrays
|
| | | .asList(AccessRestrictionType.values()), new AccessRestrictionRenderer());
|
| | | form.add(accessRestriction);
|
| | |
| | | form.add(new CheckBox("showReadme"));
|
| | | form.add(new CheckBox("skipSizeCalculation"));
|
| | | form.add(new CheckBox("skipSummaryMetrics"));
|
| | | List<Integer> maxActivityCommits = Arrays.asList(-1, 0, 25, 50, 75, 100, 150, 200, 250, 500 );
|
| | | form.add(new DropDownChoice<Integer>("maxActivityCommits", maxActivityCommits, new MaxActivityCommitsRenderer()));
|
| | |
|
| | | mailingLists = new Model<String>(ArrayUtils.isEmpty(repositoryModel.mailingLists) ? ""
|
| | | : StringUtils.flattenStrings(repositoryModel.mailingLists, " "));
|
| | | form.add(new TextField<String>("mailingLists", mailingLists));
|
| | |
| | | isAdmin = true;
|
| | | return;
|
| | | } else {
|
| | | if (!model.owner.equalsIgnoreCase(user.username)) {
|
| | | if (!model.isOwner(user.username)) {
|
| | | // User is not an Admin nor Owner
|
| | | error(getString("gb.errorOnlyAdminOrOwnerMayEditRepository"), true);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private class MaxActivityCommitsRenderer implements IChoiceRenderer<Integer> {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public MaxActivityCommitsRenderer() {
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String getDisplayValue(Integer value) {
|
| | | if (value == -1) {
|
| | | return getString("gb.excludeFromActivity");
|
| | | } else if (value == 0) {
|
| | | return getString("gb.noMaximum");
|
| | | } else {
|
| | | return value + " " + getString("gb.commits");
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String getIdValue(Integer value, int index) {
|
| | | return Integer.toString(index);
|
| | | }
|
| | | }
|
| | | |
| | | }
|