Renamed method to UserModel.canCreate(String repository)
| | |
| | | protected RepositoryModel createRepository(UserModel user, String repository, String action) {
|
| | | boolean isPush = !StringUtils.isEmpty(action) && gitReceivePack.equals(action);
|
| | | if (isPush) {
|
| | | if (user.canCreateOnPush(repository)) {
|
| | | if (user.canCreate(repository)) {
|
| | | // user is pushing to a new repository
|
| | | // validate name
|
| | | if (repository.startsWith("../")) {
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * Returns true if the user is allowed to create the specified repository
|
| | | * on-push if the repository does not already exist.
|
| | | * Returns true if the user is allowed to create the specified repository.
|
| | | *
|
| | | * @param repository
|
| | | * @return true if the user can create the repository
|
| | | */
|
| | | public boolean canCreateOnPush(String repository) {
|
| | | public boolean canCreate(String repository) {
|
| | | if (canAdmin()) {
|
| | | // admins can create any repository
|
| | | return true;
|