From af0b7b7871fd41d7ce354df10e0211108467d55a Mon Sep 17 00:00:00 2001 From: zhaopeng <imzhpe@qq.com> Date: Wed, 16 Jan 2013 09:09:09 -0500 Subject: [PATCH] 添加中文语言 --- src/com/gitblit/models/UserModel.java | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/com/gitblit/models/UserModel.java b/src/com/gitblit/models/UserModel.java index f1bc5ef..54e81cb 100644 --- a/src/com/gitblit/models/UserModel.java +++ b/src/com/gitblit/models/UserModel.java @@ -29,6 +29,7 @@ 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 @@ // 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(); } /** @@ -360,6 +368,12 @@ 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); @@ -587,6 +601,7 @@ 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) || hasTeamRepositoryPermission(repositoryName); -- Gitblit v1.9.1