diff options
Diffstat (limited to 'src/com/gitblit/models/UserModel.java')
-rw-r--r-- | src/com/gitblit/models/UserModel.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/com/gitblit/models/UserModel.java b/src/com/gitblit/models/UserModel.java index ac67ff78..bec011d9 100644 --- a/src/com/gitblit/models/UserModel.java +++ b/src/com/gitblit/models/UserModel.java @@ -29,6 +29,7 @@ import java.util.TreeSet; 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;
@@ -73,15 +74,22 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel> // 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();
}
/**
@@ -100,8 +108,7 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel> @Deprecated
@Unused
public boolean canAccessRepository(RepositoryModel repository) {
- boolean isOwner = !StringUtils.isEmpty(repository.owner)
- && repository.owner.equals(username);
+ boolean isOwner = repository.isOwner(username);
boolean allowAuthenticated = isAuthenticated && AuthorizationControl.AUTHENTICATED.equals(repository.authorizationControl);
return canAdmin() || isOwner || repositories.contains(repository.name.toLowerCase())
|| hasTeamAccess(repository.name) || allowAuthenticated;
|