summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 74fdef93543..ffa3e8a149e 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -53,8 +53,8 @@ module API
end
class ProjectMember < UserBasic
- expose :project_access, as: :access_level do |user, options|
- options[:project].users_projects.find_by(user_id: user.id).project_access
+ expose :access_level do |user, options|
+ options[:project].project_members.find_by(user_id: user.id).access_level
end
end
@@ -67,8 +67,8 @@ module API
end
class GroupMember < UserBasic
- expose :group_access, as: :access_level do |user, options|
- options[:group].users_groups.find_by(user_id: user.id).group_access
+ expose :access_level do |user, options|
+ options[:group].group_members.find_by(user_id: user.id).access_level
end
end
@@ -170,24 +170,24 @@ module API
end
class ProjectAccess < Grape::Entity
- expose :project_access, as: :access_level
+ expose :access_level
expose :notification_level
end
class GroupAccess < Grape::Entity
- expose :group_access, as: :access_level
+ expose :access_level
expose :notification_level
end
class ProjectWithAccess < Project
expose :permissions do
expose :project_access, using: Entities::ProjectAccess do |project, options|
- project.users_projects.find_by(user_id: options[:user].id)
+ project.project_members.find_by(user_id: options[:user].id)
end
expose :group_access, using: Entities::GroupAccess do |project, options|
if project.group
- project.group.users_groups.find_by(user_id: options[:user].id)
+ project.group.group_members.find_by(user_id: options[:user].id)
end
end
end