diff options
| author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-07-06 17:53:40 +0100 |
|---|---|---|
| committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-07-12 16:36:42 +0100 |
| commit | a8cf4e13b33da8d71e16874ebf3dce9ca9d40b76 (patch) | |
| tree | 57de33f76ac9f64cdf7d6acc2d3f9fcc07dcb6ea /lib/api/entities.rb | |
| parent | e1c5eb480e10329245760edd0760a5b3cb929240 (diff) | |
| download | gitlab-ce-a8cf4e13b33da8d71e16874ebf3dce9ca9d40b76.tar.gz | |
adds basic functionality to the new endpoint of the api
Diffstat (limited to 'lib/api/entities.rb')
| -rw-r--r-- | lib/api/entities.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index f00a4ac2ed6..951cca248a1 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -90,6 +90,12 @@ module API end end + class SimpleProject < Grape::Entity + expose :id + expose :name, :name_with_namespace + expose :http_url_to_repo + end + class ProjectMember < UserBasic expose :access_level do |user, options| options[:project].project_members.find_by(user_id: user.id).access_level @@ -341,12 +347,18 @@ module API end end + class SimpleProjectWithAccess < SimpleProject + expose :permissions do + expose :project_access, using: Entities::ProjectAccess do |project, options| + project.project_members.find_by(user_id: options[:user].id) + end + end + end + class ProjectWithAccess < Project expose :permissions do expose :project_access, using: Entities::ProjectAccess do |project, options| - project = Project.find_by(project[:id]) project.project_members.find_by(user_id: options[:user].id) - ] end expose :group_access, using: Entities::GroupAccess do |project, options| |
