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 ...@@ -24,7 +24,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps
select2(user.id, from: "#user_ids", multiple: true) select2(user.id, from: "#user_ids", multiple: true)
within "#new_team_member" do within "#new_team_member" do
select "Reporter", from: "project_access" select "Reporter", from: "access_level"
end end
click_button "Add users" click_button "Add users"
end end
...@@ -44,7 +44,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps ...@@ -44,7 +44,7 @@ class ProjectTeamManagement < Spinach::FeatureSteps
And 'I change "Sam" role to "Reporter"' do And 'I change "Sam" role to "Reporter"' do
user = User.find_by(name: "Sam") user = User.find_by(name: "Sam")
within "#user_#{user.id}" do within "#user_#{user.id}" do
select "Reporter", from: "team_member_project_access" select "Reporter", from: "project_member_access_level"
end end
end end
......
...@@ -53,8 +53,8 @@ module API ...@@ -53,8 +53,8 @@ module API
end end
class ProjectMember < UserBasic class ProjectMember < UserBasic
expose :project_access, as: :access_level do |user, options| expose :access_level do |user, options|
options[:project].project_members.find_by(user_id: user.id).project_access options[:project].project_members.find_by(user_id: user.id).access_level
end end
end end
...@@ -67,7 +67,7 @@ module API ...@@ -67,7 +67,7 @@ module API
end end
class GroupMember < UserBasic 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 options[:group].group_members.find_by(user_id: user.id).group_access
end end
end end
...@@ -170,12 +170,12 @@ module API ...@@ -170,12 +170,12 @@ module API
end end
class ProjectAccess < Grape::Entity class ProjectAccess < Grape::Entity
expose :project_access, as: :access_level expose :access_level
expose :notification_level expose :notification_level
end end
class GroupAccess < Grape::Entity class GroupAccess < Grape::Entity
expose :group_access, as: :access_level expose :access_level
expose :notification_level expose :notification_level
end end
......
...@@ -283,7 +283,10 @@ describe API::API, api: true do ...@@ -283,7 +283,10 @@ describe API::API, api: true do
describe 'permissions' do describe 'permissions' do
context 'personal project' 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 { response.status.should == 200 }
it { json_response['permissions']["project_access"]["access_level"].should == Gitlab::Access::MASTER } 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