diff options
author | James Moger <james.moger@gitblit.com> | 2011-05-11 22:33:16 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-05-11 22:33:16 -0400 |
commit | d0d438f480e29a5ebaf64449a5c3e7f4ebb13690 (patch) | |
tree | 2bbc3a8717c1d8001297e6c2d7ccfdbf6f2732d2 /src/com/gitblit/wicket | |
parent | 511554c6bdd7daa080506fb62400bf6d295ab9e2 (diff) | |
download | gitblit-d0d438f480e29a5ebaf64449a5c3e7f4ebb13690.tar.gz gitblit-d0d438f480e29a5ebaf64449a5c3e7f4ebb13690.zip |
Clarified access restrictions.
Diffstat (limited to 'src/com/gitblit/wicket')
-rw-r--r-- | src/com/gitblit/wicket/models/UserModel.java | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/com/gitblit/wicket/models/UserModel.java b/src/com/gitblit/wicket/models/UserModel.java index c65d3564..34c32e71 100644 --- a/src/com/gitblit/wicket/models/UserModel.java +++ b/src/com/gitblit/wicket/models/UserModel.java @@ -4,8 +4,6 @@ import java.io.Serializable; import java.util.ArrayList;
import java.util.List;
-import com.gitblit.Constants.AccessRestrictionType;
-
public class UserModel implements Serializable {
private static final long serialVersionUID = 1L;
@@ -39,27 +37,9 @@ public class UserModel implements Serializable { public boolean canAdmin() {
return canAdmin;
}
-
- public boolean canClone(RepositoryModel repository) {
- return canAccess(repository, AccessRestrictionType.CLONE);
- }
- public boolean canPush(RepositoryModel repository) {
- return canAccess(repository, AccessRestrictionType.PUSH);
- }
-
- public boolean canView(RepositoryModel repository) {
- return canAccess(repository, AccessRestrictionType.VIEW);
- }
-
- private boolean canAccess(RepositoryModel repository, AccessRestrictionType minimum) {
- if (repository.accessRestriction.atLeast(minimum)) {
- // repository is restricted, must check roles
- return canAdmin || repositories.contains(repository.name);
- } else {
- // repository is not restricted
- return true;
- }
+ public boolean canAccessRepository(String repositoryName) {
+ return canAdmin || repositories.contains(repositoryName);
}
public void setCookie(String cookie) {
|