summaryrefslogtreecommitdiff
path: root/app/models/group.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-08-07 00:20:02 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-08-07 00:20:02 -0400
commitfb6dc1f07de124915e48456bf45c108878687043 (patch)
tree3b086430eed3f4f88fc2ca6eb77a9476b841ede4 /app/models/group.rb
parent5fb5fd253a960ed33eebc0f6aabeae37aa175fa8 (diff)
downloadgitlab-ce-fb6dc1f07de124915e48456bf45c108878687043.tar.gz
Add `Group#add_*` convenience methodsrs-group-convenience-methods
Encapsulates the logic for `Gitlab::Access::WHATEVER` levels.
Diffstat (limited to 'app/models/group.rb')
-rw-r--r--app/models/group.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index cfb8faa1491..4ff610f8e9d 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -76,8 +76,24 @@ class Group < Namespace
add_users([user], access_level, current_user)
end
+ def add_guest(user, current_user = nil)
+ add_user(user, Gitlab::Access::GUEST, current_user)
+ end
+
+ def add_reporter(user, current_user = nil)
+ add_user(user, Gitlab::Access::REPORTER, current_user)
+ end
+
+ def add_developer(user, current_user = nil)
+ add_user(user, Gitlab::Access::DEVELOPER, current_user)
+ end
+
+ def add_master(user, current_user = nil)
+ add_user(user, Gitlab::Access::MASTER, current_user)
+ end
+
def add_owner(user, current_user = nil)
- self.add_user(user, Gitlab::Access::OWNER, current_user)
+ add_user(user, Gitlab::Access::OWNER, current_user)
end
def has_owner?(user)