| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Collections;
|
| | | import java.util.Date;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.GitBlitException;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.RepositoryModel;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.wicket.BasePage;
|
| | | import com.gitblit.wicket.GitBlitWebSession;
|
| | | import com.gitblit.wicket.WicketUtils;
|
| | | import com.gitblit.wicket.models.RepositoryModel;
|
| | | import com.gitblit.wicket.models.UserModel;
|
| | |
|
| | | public class EditRepositoryPage extends BasePage {
|
| | |
|
| | |
| | | // create constructor
|
| | | super();
|
| | | isCreate = true;
|
| | | setupPage(new RepositoryModel("", "", "", new Date()));
|
| | | setupPage(new RepositoryModel());
|
| | | }
|
| | |
|
| | | public EditRepositoryPage(PageParameters params) {
|
| | |
| | |
|
| | | // automatically convert backslashes to forward slashes
|
| | | repositoryModel.name = repositoryModel.name.replace('\\', '/');
|
| | | // Automatically replace // with /
|
| | | repositoryModel.name = repositoryModel.name.replace("//", "/");
|
| | |
|
| | | // prohibit folder paths
|
| | | if (repositoryModel.name.startsWith("/")) {
|
| | | error("Leading root folder references (/) are prohibited.");
|
| | | return;
|
| | | }
|
| | | if (repositoryModel.name.startsWith("../")) {
|
| | | error("Relative folder references (../) are prohibited.");
|
| | | return;
|
| | | }
|
| | | if (repositoryModel.name.contains("/../")) {
|
| | | error("Relative folder references (../) are prohibited.");
|
| | | return;
|
| | | }
|
| | |
|
| | | // confirm valid characters in repository name
|
| | | char[] validChars = { '/', '.', '_', '-' };
|
| | |
| | | }
|
| | |
|
| | | // save the repository
|
| | | GitBlit.self().editRepositoryModel(oldName, repositoryModel, isCreate);
|
| | | GitBlit.self().updateRepositoryModel(oldName, repositoryModel, isCreate);
|
| | |
|
| | | // save the repository access list
|
| | | if (repositoryModel.accessRestriction.exceeds(AccessRestrictionType.NONE)) {
|
| | |
| | | form.add(new CheckBox("useTickets"));
|
| | | form.add(new CheckBox("useDocs"));
|
| | | form.add(new CheckBox("showRemoteBranches"));
|
| | | form.add(new CheckBox("showReadme"));
|
| | | form.add(usersPalette);
|
| | |
|
| | | add(form);
|