James Moger
2012-10-18 13417cf9c6eec555b51da49742e47939d2f5715b
src/com/gitblit/models/TeamModel.java
@@ -18,6 +18,7 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -41,6 +42,9 @@
   // field names are reflectively mapped in EditTeam page
   public String name;
   public boolean canAdmin;
   public boolean canFork;
   public boolean canCreate;
   public final Set<String> users = new HashSet<String>();
   // retained for backwards-compatibility with RPC clients
   @Deprecated
@@ -82,6 +86,21 @@
   public void removeRepository(String name) {
      removeRepositoryPermission(name);
   }
   /**
    * Returns a list of repository permissions for this team.
    *
    * @return the team's list of permissions
    */
   public List<RepositoryAccessPermission> getRepositoryPermissions() {
      List<RepositoryAccessPermission> list = new ArrayList<RepositoryAccessPermission>();
      for (Map.Entry<String, AccessPermission> entry : permissions.entrySet()) {
         list.add(new RepositoryAccessPermission(entry.getKey(), entry.getValue()));
      }
      Collections.sort(list);
      return list;
   }
   
   /**
    * Returns true if the team has any type of specified access permission for
@@ -92,7 +111,21 @@
    */
   public boolean hasRepositoryPermission(String name) {
      String repository = AccessPermission.repositoryFromRole(name).toLowerCase();
      return permissions.containsKey(repository) || repositories.contains(repository);
      if (permissions.containsKey(repository)) {
         // exact repository permission specified
         return true;
      } else {
         // search for regex permission match
         for (String key : permissions.keySet()) {
            if (name.matches(key)) {
               AccessPermission p = permissions.get(key);
               if (p != null) {
                  return true;
               }
            }
         }
      }
      return false;
   }
   
   /**