Commit ce49f035 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix access_level api

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 77c64a9b
......@@ -24,7 +24,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps
select2(user.id, from: "#user_ids", multiple: true)
within "#new_team_member" do
select "Reporter", from: "project_access"
select "Reporter", from: "access_level"
end
click_button "Add users"
end
......@@ -44,7 +44,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps
And 'I change "Sam" role to "Reporter"' do
user = User.find_by(name: "Sam")
within "#user_#{user.id}" do
select "Reporter", from: "team_member_project_access"
select "Reporter", from: "project_member_access_level"
end
end
......
......@@ -53,8 +53,8 @@ module API
end
class ProjectMember < UserBasic
expose :project_access, as: :access_level do |user, options|
options[:project].project_members.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,7 +67,7 @@ module API
end
class GroupMember < UserBasic
expose :group_access, as: :access_level do |user, options|
expose :access_level do |user, options|
options[:group].group_members.find_by(user_id: user.id).group_access
end
end
......@@ -170,12 +170,12 @@ 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
......
......@@ -283,7 +283,10 @@ describe API::API, api: true do
describe 'permissions' do
context 'personal project' do
before { get api("/projects/#{project.id}", user) }
before do
project.team << [user, :master]
get api("/projects/#{project.id}", user)
end
it { response.status.should == 200 }
it { json_response['permissions']["project_access"]["access_level"].should == Gitlab::Access::MASTER }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment