]> source.dussan.org Git - gitblit.git/commitdiff
Remove deprecated methods from User and Team models
authorJames Moger <james.moger@gitblit.com>
Wed, 11 Dec 2013 15:58:36 +0000 (10:58 -0500)
committerJames Moger <james.moger@gitblit.com>
Wed, 11 Dec 2013 15:58:36 +0000 (10:58 -0500)
Change-Id: Ief3231270e55b8e4075de45c70ee24517b05b3fc

src/main/java/com/gitblit/models/TeamModel.java
src/main/java/com/gitblit/models/UserModel.java
src/main/java/com/gitblit/servlet/AuthenticationFilter.java

index aaa3d54a167e3f99fadf05b66da369a1df0b8dec..f4a484cbfc028b7113c433481f07184eb7964cbf 100644 (file)
@@ -30,7 +30,6 @@ import com.gitblit.Constants.AccessRestrictionType;
 import com.gitblit.Constants.AccountType;\r
 import com.gitblit.Constants.PermissionType;\r
 import com.gitblit.Constants.RegistrantType;\r
-import com.gitblit.Constants.Unused;\r
 import com.gitblit.utils.StringUtils;\r
 \r
 /**\r
@@ -64,36 +63,6 @@ public class TeamModel implements Serializable, Comparable<TeamModel> {
                this.accountType = AccountType.LOCAL;\r
        }\r
 \r
-       /**\r
-        * @use hasRepositoryPermission\r
-        * @param name\r
-        * @return\r
-        */\r
-       @Deprecated\r
-       @Unused\r
-       public boolean hasRepository(String name) {\r
-               return hasRepositoryPermission(name);\r
-       }\r
-\r
-       @Deprecated\r
-       @Unused\r
-       public void addRepository(String name) {\r
-               addRepositoryPermission(name);\r
-       }\r
-\r
-       @Deprecated\r
-       @Unused\r
-       public void addRepositories(Collection<String> names) {\r
-               addRepositoryPermissions(names);\r
-       }\r
-\r
-       @Deprecated\r
-       @Unused\r
-       public void removeRepository(String name) {\r
-               removeRepositoryPermission(name);\r
-       }\r
-\r
-\r
        /**\r
         * Returns a list of repository permissions for this team.\r
         *\r
index 3c33bd32ce26cb3ba57fe7ce735aac1b552295ed..6419cce91257c0fb3fb779e37334c08a3dcf8452 100644 (file)
@@ -34,7 +34,6 @@ import com.gitblit.Constants.AccountType;
 import com.gitblit.Constants.AuthorizationControl;\r
 import com.gitblit.Constants.PermissionType;\r
 import com.gitblit.Constants.RegistrantType;\r
-import com.gitblit.Constants.Unused;\r
 import com.gitblit.utils.ArrayUtils;\r
 import com.gitblit.utils.ModelUtils;\r
 import com.gitblit.utils.StringUtils;\r
@@ -100,57 +99,6 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel>
                                || accountType.isLocal();\r
        }\r
 \r
-       /**\r
-        * This method does not take into consideration Ownership where the\r
-        * administrator has not explicitly granted access to the owner.\r
-        *\r
-        * @param repositoryName\r
-        * @return\r
-        */\r
-       @Deprecated\r
-       public boolean canAccessRepository(String repositoryName) {\r
-               return canAdmin() || repositories.contains(repositoryName.toLowerCase())\r
-                               || hasTeamAccess(repositoryName);\r
-       }\r
-\r
-       @Deprecated\r
-       @Unused\r
-       public boolean canAccessRepository(RepositoryModel repository) {\r
-               boolean isOwner = repository.isOwner(username);\r
-               boolean allowAuthenticated = isAuthenticated && AuthorizationControl.AUTHENTICATED.equals(repository.authorizationControl);\r
-               return canAdmin() || isOwner || repositories.contains(repository.name.toLowerCase())\r
-                               || hasTeamAccess(repository.name) || allowAuthenticated;\r
-       }\r
-\r
-       @Deprecated\r
-       @Unused\r
-       public boolean hasTeamAccess(String repositoryName) {\r
-               for (TeamModel team : teams) {\r
-                       if (team.hasRepositoryPermission(repositoryName)) {\r
-                               return true;\r
-                       }\r
-               }\r
-               return false;\r
-       }\r
-\r
-       @Deprecated\r
-       @Unused\r
-       public boolean hasRepository(String name) {\r
-               return hasRepositoryPermission(name);\r
-       }\r
-\r
-       @Deprecated\r
-       @Unused\r
-       public void addRepository(String name) {\r
-               addRepositoryPermission(name);\r
-       }\r
-\r
-       @Deprecated\r
-       @Unused\r
-       public void removeRepository(String name) {\r
-               removeRepositoryPermission(name);\r
-       }\r
-\r
        /**\r
         * Returns a list of repository permissions for this user exclusive of\r
         * permissions inherited from team memberships.\r
@@ -668,12 +616,6 @@ public class UserModel implements Principal, Serializable, Comparable<UserModel>
                return nameVerified && emailVerified;\r
        }\r
 \r
-       @Deprecated\r
-       public boolean hasBranchPermission(String repositoryName, String branch) {\r
-               // Default UserModel doesn't implement branch-level security. Other Realms (i.e. Gerrit) may override this method.\r
-               return hasRepositoryPermission(repositoryName) || hasTeamRepositoryPermission(repositoryName);\r
-       }\r
-\r
        public boolean isMyPersonalRepository(String repository) {\r
                String projectPath = StringUtils.getFirstPathElement(repository);\r
                return !StringUtils.isEmpty(projectPath) && projectPath.equalsIgnoreCase(getPersonalPath());\r
index 54c701418a5622982ce9dd59f88491098c84bb51..344786624de7da3d08d92021f5765f26ed3e5db5 100644 (file)
@@ -184,7 +184,7 @@ public abstract class AuthenticationFilter implements Filter {
                        // Gitblit does not currently use actual roles in the traditional\r
                        // servlet container sense.  That is the reason this is marked\r
                        // deprecated, but I may want to revisit this.\r
-                       return user.canAccessRepository(role);\r
+                       return user.hasRepositoryPermission(role);\r
                }\r
 \r
                @Override\r