| | |
| | | return canAdmin() || model.isUsersPersonalRepository(username) || model.isOwner(username);
|
| | | }
|
| | |
|
| | | public boolean canEdit(TicketModel ticket, RepositoryModel repository) {
|
| | | return isAuthenticated() &&
|
| | | (canPush(repository)
|
| | | || (ticket != null && username.equals(ticket.responsible))
|
| | | || (ticket != null && username.equals(ticket.createdBy)));
|
| | | }
|
| | |
|
| | | public boolean canAdmin(TicketModel ticket, RepositoryModel repository) {
|
| | | return isAuthenticated() &&
|
| | | (canPush(repository)
|
| | | || ticket != null && username.equals(ticket.responsible));
|
| | | }
|
| | |
|
| | | public boolean canReviewPatchset(RepositoryModel model) {
|
| | | return isAuthenticated && canClone(model);
|
| | | return isAuthenticated() && canClone(model);
|
| | | }
|
| | |
|
| | | public boolean canApprovePatchset(RepositoryModel model) {
|
| | | return isAuthenticated && canPush(model);
|
| | | return isAuthenticated() && canPush(model);
|
| | | }
|
| | |
|
| | | public boolean canVetoPatchset(RepositoryModel model) {
|
| | | return isAuthenticated && canPush(model);
|
| | | return isAuthenticated() && canPush(model);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | // admins can create any repository
|
| | | return true;
|
| | | }
|
| | | if (canCreate) {
|
| | | if (canCreate()) {
|
| | | String projectPath = StringUtils.getFirstPathElement(repository);
|
| | | if (!StringUtils.isEmpty(projectPath) && projectPath.equalsIgnoreCase(getPersonalPath())) {
|
| | | // personal repository
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Returns true if the user is allowed to administer the specified repository
|
| | | *
|
| | | * @param repo
|
| | | * @return true if the user can administer the repository
|
| | | */
|
| | | public boolean canAdmin(RepositoryModel repo) {
|
| | | return canAdmin() || repo.isOwner(username) || isMyPersonalRepository(repo.name);
|
| | | }
|
| | |
|
| | | public boolean isAuthenticated() {
|
| | | return !UserModel.ANONYMOUS.equals(this) && isAuthenticated;
|
| | | }
|
| | |
|
| | | public boolean isTeamMember(String teamname) {
|
| | | for (TeamModel team : teams) {
|
| | | if (team.name.equalsIgnoreCase(teamname)) {
|