Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
168197cd
Commit
168197cd
authored
Oct 18, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix project member access levels
parent
b1df8c4e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
1 deletion
+64
-1
CHANGELOG.md
CHANGELOG.md
+1
-0
db/migrate/20161018124658_make_project_owners_masters.rb
db/migrate/20161018124658_make_project_owners_masters.rb
+15
-0
db/schema.rb
db/schema.rb
+1
-1
spec/controllers/projects/project_members_controller_spec.rb
spec/controllers/projects/project_members_controller_spec.rb
+36
-0
spec/requests/api/members_spec.rb
spec/requests/api/members_spec.rb
+11
-0
No files found.
CHANGELOG.md
View file @
168197cd
...
...
@@ -137,6 +137,7 @@ Please view this file on the master branch, on stable branches it's out of date.
-
Fix buggy iOS tooltip layering behavior.
-
Make guests unable to view MRs on private projects
-
Fix broken Project API docs (Takuya Noguchi)
-
Migrate invalid project members (owner -> master)
## 8.12.7
...
...
db/migrate/20161018124658_make_project_owners_masters.rb
0 → 100644
View file @
168197cd
class
MakeProjectOwnersMasters
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
up
update_column_in_batches
(
:members
,
:access_level
,
40
)
do
|
table
,
query
|
query
.
where
(
table
[
:access_level
].
eq
(
50
).
and
(
table
[
:source_type
].
eq
(
'Project'
)))
end
end
def
down
# do nothing
end
end
db/schema.rb
View file @
168197cd
...
...
@@ -843,7 +843,7 @@ ActiveRecord::Schema.define(version: 20161019213545) do
t
.
integer
"builds_access_level"
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
integer
"repository_access_level"
,
default:
20
,
null:
false
t
.
integer
"repository_access_level"
,
default:
20
,
null:
false
end
add_index
"project_features"
,
[
"project_id"
],
name:
"index_project_features_on_project_id"
,
using: :btree
...
...
spec/controllers/projects/project_members_controller_spec.rb
View file @
168197cd
...
...
@@ -228,4 +228,40 @@ describe Projects::ProjectMembersController do
end
end
end
describe
'POST create'
do
let
(
:stranger
)
{
create
(
:user
)
}
context
'when creating owner'
do
before
do
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
end
it
'does not create a member'
do
expect
do
post
:create
,
user_ids:
stranger
.
id
,
namespace_id:
project
.
namespace
,
access_level:
Member
::
OWNER
,
project_id:
project
end
.
to
change
{
project
.
members
.
count
}.
by
(
0
)
end
end
context
'when create master'
do
before
do
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
end
it
'creates a member'
do
expect
do
post
:create
,
user_ids:
stranger
.
id
,
namespace_id:
project
.
namespace
,
access_level:
Member
::
MASTER
,
project_id:
project
end
.
to
change
{
project
.
members
.
count
}.
by
(
1
)
end
end
end
end
spec/requests/api/members_spec.rb
View file @
168197cd
...
...
@@ -328,4 +328,15 @@ describe API::Members, api: true do
it_behaves_like
'DELETE /:sources/:id/members/:user_id'
,
'group'
do
let
(
:source
)
{
group
}
end
context
'Adding owner to project'
do
it
'returns 403'
do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/members"
,
master
),
user_id:
stranger
.
id
,
access_level:
Member
::
OWNER
expect
(
response
).
to
have_http_status
(
422
)
end
.
to
change
{
project
.
members
.
count
}.
by
(
0
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment