| | |
| | | for (RepositoryModel model : getRepositoryModels(user)) {
|
| | | if (model.isUsersPersonalRepository(username)) {
|
| | | // personal repository
|
| | | model.owner = user.username;
|
| | | model.addOwner(user.username);
|
| | | String oldRepositoryName = model.name;
|
| | | model.name = "~" + user.username + model.name.substring(model.projectPath.length());
|
| | | model.projectPath = "~" + user.username;
|
| | | updateRepositoryModel(oldRepositoryName, model, false);
|
| | | } else if (model.isOwner(username)) {
|
| | | // common/shared repo
|
| | | model.owner = user.username;
|
| | | model.addOwner(user.username);
|
| | | updateRepositoryModel(model.name, model, false);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | if (config != null) {
|
| | | model.description = getConfig(config, "description", "");
|
| | | model.owner = getConfig(config, "owner", "");
|
| | | model.addOwners(ArrayUtils.fromString(getConfig(config, "owner", "")));
|
| | | model.useTickets = getConfig(config, "useTickets", false);
|
| | | model.useDocs = getConfig(config, "useDocs", false);
|
| | | model.allowForks = getConfig(config, "allowForks", true);
|
| | |
| | | public void updateConfiguration(Repository r, RepositoryModel repository) {
|
| | | StoredConfig config = r.getConfig();
|
| | | config.setString(Constants.CONFIG_GITBLIT, null, "description", repository.description);
|
| | | config.setString(Constants.CONFIG_GITBLIT, null, "owner", repository.owner);
|
| | | config.setString(Constants.CONFIG_GITBLIT, null, "owner", ArrayUtils.toString(repository.owners));
|
| | | config.setBoolean(Constants.CONFIG_GITBLIT, null, "useTickets", repository.useTickets);
|
| | | config.setBoolean(Constants.CONFIG_GITBLIT, null, "useDocs", repository.useDocs);
|
| | | config.setBoolean(Constants.CONFIG_GITBLIT, null, "allowForks", repository.allowForks);
|
| | |
| | | // create a Gitblit repository model for the clone
|
| | | RepositoryModel cloneModel = repository.cloneAs(cloneName);
|
| | | // owner has REWIND/RW+ permissions
|
| | | cloneModel.owner = user.username;
|
| | | cloneModel.addOwner(user.username);
|
| | | updateRepositoryModel(cloneName, cloneModel, false);
|
| | |
|
| | | // add the owner of the source repository to the clone's access list
|
| | | if (!StringUtils.isEmpty(repository.owner)) {
|
| | | UserModel originOwner = getUserModel(repository.owner);
|
| | | if (originOwner != null) {
|
| | | originOwner.setRepositoryPermission(cloneName, AccessPermission.CLONE);
|
| | | updateUserModel(originOwner.username, originOwner, false);
|
| | | if (!ArrayUtils.isEmpty(repository.owners)) {
|
| | | for (String owner : repository.owners) {
|
| | | UserModel originOwner = getUserModel(owner);
|
| | | if (originOwner != null) {
|
| | | originOwner.setRepositoryPermission(cloneName, AccessPermission.CLONE);
|
| | | updateUserModel(originOwner.username, originOwner, false);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|