summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-05-25 16:51:37 -0400
committerStan Hu <stanhu@gmail.com>2015-05-28 11:39:12 -0700
commit67992b9be6fc19ef4cc06de48995d1ee9617049a (patch)
treeccd191c5d27b5c9597daa4ca2e6ae1fb655ad823 /app/models
parent06250eef2e12ed509b88f3770ae6d3fa4614b74d (diff)
downloadgitlab-ce-67992b9be6fc19ef4cc06de48995d1ee9617049a.tar.gz
Make namespace API available to all users
Closes https://github.com/gitlabhq/gitlabhq/issues/9328
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 50ca4bc5acc..8058a0dab8e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -655,6 +655,12 @@ class User < ActiveRecord::Base
end
end
+ def namespaces
+ namespace_ids = groups.pluck(:id)
+ namespace_ids.push(namespace.id)
+ Namespace.where(id: namespace_ids)
+ end
+
def oauth_authorized_tokens
Doorkeeper::AccessToken.where(resource_owner_id: self.id, revoked_at: nil)
end