diff options
author | James Moger <james.moger@gitblit.com> | 2013-12-11 10:58:36 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-12-11 10:58:36 -0500 |
commit | 7127dfb2def0c43abb38bc363e3f76fded881bf0 (patch) | |
tree | b6b4aa00d29b8297683ea45333717331cabe4f69 /src/main/java | |
parent | 619291b080176f65b85fe9ca4d0df56cb9ad8393 (diff) | |
download | gitblit-7127dfb2def0c43abb38bc363e3f76fded881bf0.tar.gz gitblit-7127dfb2def0c43abb38bc363e3f76fded881bf0.zip |
Remove deprecated methods from User and Team models
Change-Id: Ief3231270e55b8e4075de45c70ee24517b05b3fc
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/gitblit/models/TeamModel.java | 31 | ||||
-rw-r--r-- | src/main/java/com/gitblit/models/UserModel.java | 58 | ||||
-rw-r--r-- | src/main/java/com/gitblit/servlet/AuthenticationFilter.java | 2 |
3 files changed, 1 insertions, 90 deletions
diff --git a/src/main/java/com/gitblit/models/TeamModel.java b/src/main/java/com/gitblit/models/TeamModel.java index aaa3d54a..f4a484cb 100644 --- a/src/main/java/com/gitblit/models/TeamModel.java +++ b/src/main/java/com/gitblit/models/TeamModel.java @@ -30,7 +30,6 @@ import com.gitblit.Constants.AccessRestrictionType; import com.gitblit.Constants.AccountType;
import com.gitblit.Constants.PermissionType;
import com.gitblit.Constants.RegistrantType;
-import com.gitblit.Constants.Unused;
import com.gitblit.utils.StringUtils;
/**
@@ -65,36 +64,6 @@ public class TeamModel implements Serializable, Comparable<TeamModel> { }
/**
- * @use hasRepositoryPermission
- * @param name
- * @return
- */
- @Deprecated
- @Unused
- public boolean hasRepository(String name) {
- return hasRepositoryPermission(name);
- }
-
- @Deprecated
- @Unused
- public void addRepository(String name) {
- addRepositoryPermission(name);
- }
-
- @Deprecated
- @Unused
- public void addRepositories(Collection<String> names) {
- addRepositoryPermissions(names);
- }
-
- @Deprecated
- @Unused
- public void removeRepository(String name) {
- removeRepositoryPermission(name);
- }
-
-
- /**
* Returns a list of repository permissions for this team.
*
* @return the team's list of permissions
diff --git a/src/main/java/com/gitblit/models/UserModel.java b/src/main/java/com/gitblit/models/UserModel.java index 3c33bd32..6419cce9 100644 --- a/src/main/java/com/gitblit/models/UserModel.java +++ b/src/main/java/com/gitblit/models/UserModel.java @@ -34,7 +34,6 @@ import com.gitblit.Constants.AccountType; import com.gitblit.Constants.AuthorizationControl;
import com.gitblit.Constants.PermissionType;
import com.gitblit.Constants.RegistrantType;
-import com.gitblit.Constants.Unused;
import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.ModelUtils;
import com.gitblit.utils.StringUtils;
@@ -101,57 +100,6 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel> }
/**
- * This method does not take into consideration Ownership where the
- * administrator has not explicitly granted access to the owner.
- *
- * @param repositoryName
- * @return
- */
- @Deprecated
- public boolean canAccessRepository(String repositoryName) {
- return canAdmin() || repositories.contains(repositoryName.toLowerCase())
- || hasTeamAccess(repositoryName);
- }
-
- @Deprecated
- @Unused
- public boolean canAccessRepository(RepositoryModel repository) {
- 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;
- }
-
- @Deprecated
- @Unused
- public boolean hasTeamAccess(String repositoryName) {
- for (TeamModel team : teams) {
- if (team.hasRepositoryPermission(repositoryName)) {
- return true;
- }
- }
- return false;
- }
-
- @Deprecated
- @Unused
- public boolean hasRepository(String name) {
- return hasRepositoryPermission(name);
- }
-
- @Deprecated
- @Unused
- public void addRepository(String name) {
- addRepositoryPermission(name);
- }
-
- @Deprecated
- @Unused
- public void removeRepository(String name) {
- removeRepositoryPermission(name);
- }
-
- /**
* Returns a list of repository permissions for this user exclusive of
* permissions inherited from team memberships.
*
@@ -668,12 +616,6 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel> 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);
- }
-
public boolean isMyPersonalRepository(String repository) {
String projectPath = StringUtils.getFirstPathElement(repository);
return !StringUtils.isEmpty(projectPath) && projectPath.equalsIgnoreCase(getPersonalPath());
diff --git a/src/main/java/com/gitblit/servlet/AuthenticationFilter.java b/src/main/java/com/gitblit/servlet/AuthenticationFilter.java index 54c70141..34478662 100644 --- a/src/main/java/com/gitblit/servlet/AuthenticationFilter.java +++ b/src/main/java/com/gitblit/servlet/AuthenticationFilter.java @@ -184,7 +184,7 @@ public abstract class AuthenticationFilter implements Filter { // Gitblit does not currently use actual roles in the traditional
// servlet container sense. That is the reason this is marked
// deprecated, but I may want to revisit this.
- return user.canAccessRepository(role);
+ return user.hasRepositoryPermission(role);
}
@Override
|