From 87f6c3e6510986a6676872aa64aed66fe7f24b01 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Mon, 22 Oct 2012 16:15:40 -0400 Subject: [PATCH] Differentiate between an explicit permission and a regex permission --- src/com/gitblit/models/UserModel.java | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/src/com/gitblit/models/UserModel.java b/src/com/gitblit/models/UserModel.java index 7733704..97430bf 100644 --- a/src/com/gitblit/models/UserModel.java +++ b/src/com/gitblit/models/UserModel.java @@ -137,7 +137,7 @@ public List<RegistrantAccessPermission> getRepositoryPermissions() { List<RegistrantAccessPermission> list = new ArrayList<RegistrantAccessPermission>(); for (Map.Entry<String, AccessPermission> entry : permissions.entrySet()) { - list.add(new RegistrantAccessPermission(entry.getKey(), entry.getValue(), RegistrantType.REPOSITORY)); + list.add(new RegistrantAccessPermission(entry.getKey(), entry.getValue(), true, RegistrantType.REPOSITORY)); } Collections.sort(list); return list; @@ -170,6 +170,18 @@ } /** + * Returns true if the user has an explicitly specified access permission for + * this repository. + * + * @param name + * @return if the user has an explicitly specified access permission + */ + public boolean hasExplicitRepositoryPermission(String name) { + String repository = AccessPermission.repositoryFromRole(name).toLowerCase(); + return permissions.containsKey(repository); + } + + /** * Adds a repository permission to the team. * <p> * Role may be formatted as: -- Gitblit v1.9.1