| | |
| | |
|
| | | import com.gitblit.Constants.AccessPermission;
|
| | | import com.gitblit.Constants.AccessRestrictionType;
|
| | | import com.gitblit.Constants.AccountType;
|
| | | import com.gitblit.Constants.AuthorizationControl;
|
| | | import com.gitblit.Constants.PermissionType;
|
| | | import com.gitblit.Constants.RegistrantType;
|
| | |
| | |
|
| | | // non-persisted fields
|
| | | public boolean isAuthenticated;
|
| | | public AccountType accountType;
|
| | |
|
| | | public UserModel(String username) {
|
| | | this.username = username;
|
| | | this.isAuthenticated = true;
|
| | | this.accountType = AccountType.LOCAL;
|
| | | }
|
| | |
|
| | | private UserModel() {
|
| | | this.username = "$anonymous";
|
| | | this.isAuthenticated = false;
|
| | | this.accountType = AccountType.LOCAL;
|
| | | }
|
| | | |
| | | public boolean isLocalAccount() {
|
| | | return accountType.isLocal();
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | public boolean canView(RepositoryModel repository) {
|
| | | return canAccess(repository, AccessRestrictionType.VIEW, AccessPermission.VIEW);
|
| | | }
|
| | | |
| | | public boolean canView(RepositoryModel repository, String ref) {
|
| | | // Default UserModel doesn't implement ref-level security.
|
| | | // Other Realms (i.e. Gerrit) may override this method.
|
| | | return canView(repository);
|
| | | }
|
| | |
|
| | | public boolean canClone(RepositoryModel repository) {
|
| | | return canAccess(repository, AccessRestrictionType.CLONE, AccessPermission.CLONE);
|
| | |
| | | return nameVerified && emailVerified;
|
| | | }
|
| | |
|
| | | @Deprecated
|
| | | public boolean hasBranchPermission(String repositoryName, String branch) {
|
| | | // Default UserModel doesn't implement branch-level security. Other Realms (i.e. Gerrit) may override this method.
|
| | | return hasRepositoryPermission(repositoryName);
|
| | | return hasRepositoryPermission(repositoryName) || hasTeamRepositoryPermission(repositoryName);
|
| | | }
|
| | |
|
| | | public boolean isMyPersonalRepository(String repository) {
|