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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
5898fa26
Commit
5898fa26
authored
Aug 15, 2016
by
Timothy Andrew
Committed by
Alfredo Sumaran
Oct 17, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing a group from a project removes it's access levels (if any).
(Protected branch access levels)
parent
017c056d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
0 deletions
+19
-0
app/models/project_group_link.rb
app/models/project_group_link.rb
+9
-0
app/models/protected_branch.rb
app/models/protected_branch.rb
+8
-0
app/models/protected_branch/merge_access_level.rb
app/models/protected_branch/merge_access_level.rb
+1
-0
app/models/protected_branch/push_access_level.rb
app/models/protected_branch/push_access_level.rb
+1
-0
No files found.
app/models/project_group_link.rb
View file @
5898fa26
...
@@ -16,6 +16,8 @@ class ProjectGroupLink < ActiveRecord::Base
...
@@ -16,6 +16,8 @@ class ProjectGroupLink < ActiveRecord::Base
validates
:group_access
,
inclusion:
{
in:
Gitlab
::
Access
.
values
},
presence:
true
validates
:group_access
,
inclusion:
{
in:
Gitlab
::
Access
.
values
},
presence:
true
validate
:different_group
validate
:different_group
before_destroy
:delete_branch_protection
def
self
.
access_options
def
self
.
access_options
Gitlab
::
Access
.
options
Gitlab
::
Access
.
options
end
end
...
@@ -35,4 +37,11 @@ class ProjectGroupLink < ActiveRecord::Base
...
@@ -35,4 +37,11 @@ class ProjectGroupLink < ActiveRecord::Base
errors
.
add
(
:base
,
"Project cannot be shared with the project it is in."
)
errors
.
add
(
:base
,
"Project cannot be shared with the project it is in."
)
end
end
end
end
def
delete_branch_protection
if
group
.
present?
&&
project
.
present?
project
.
protected_branches
.
merge_access_by_group
(
group
).
destroy_all
project
.
protected_branches
.
push_access_by_group
(
group
).
destroy_all
end
end
end
end
app/models/protected_branch.rb
View file @
5898fa26
...
@@ -22,6 +22,14 @@ class ProtectedBranch < ActiveRecord::Base
...
@@ -22,6 +22,14 @@ class ProtectedBranch < ActiveRecord::Base
# access to the given user.
# access to the given user.
scope
:push_access_by_user
,
->
(
user
)
{
PushAccessLevel
.
joins
(
:protected_branch
).
where
(
protected_branch_id:
self
.
ids
).
merge
(
PushAccessLevel
.
by_user
(
user
))
}
scope
:push_access_by_user
,
->
(
user
)
{
PushAccessLevel
.
joins
(
:protected_branch
).
where
(
protected_branch_id:
self
.
ids
).
merge
(
PushAccessLevel
.
by_user
(
user
))
}
# Returns all merge access levels (for protected branches in scope) that grant merge
# access to the given group.
scope
:merge_access_by_group
,
->
(
group
)
{
MergeAccessLevel
.
joins
(
:protected_branch
).
where
(
protected_branch_id:
self
.
ids
).
merge
(
MergeAccessLevel
.
by_group
(
group
))
}
# Returns all push access levels (for protected branches in scope) that grant push
# access to the given group.
scope
:push_access_by_group
,
->
(
group
)
{
PushAccessLevel
.
joins
(
:protected_branch
).
where
(
protected_branch_id:
self
.
ids
).
merge
(
PushAccessLevel
.
by_group
(
group
))
}
def
commit
def
commit
project
.
commit
(
self
.
name
)
project
.
commit
(
self
.
name
)
end
end
...
...
app/models/protected_branch/merge_access_level.rb
View file @
5898fa26
...
@@ -11,6 +11,7 @@ class ProtectedBranch::MergeAccessLevel < ActiveRecord::Base
...
@@ -11,6 +11,7 @@ class ProtectedBranch::MergeAccessLevel < ActiveRecord::Base
Gitlab
::
Access
::
DEVELOPER
]
}
Gitlab
::
Access
::
DEVELOPER
]
}
scope
:by_user
,
->
(
user
)
{
where
(
user:
user
)
}
scope
:by_user
,
->
(
user
)
{
where
(
user:
user
)
}
scope
:by_group
,
->
(
group
)
{
where
(
group:
group
)
}
def
self
.
human_access_levels
def
self
.
human_access_levels
{
{
...
...
app/models/protected_branch/push_access_level.rb
View file @
5898fa26
...
@@ -12,6 +12,7 @@ class ProtectedBranch::PushAccessLevel < ActiveRecord::Base
...
@@ -12,6 +12,7 @@ class ProtectedBranch::PushAccessLevel < ActiveRecord::Base
Gitlab
::
Access
::
NO_ACCESS
]
}
Gitlab
::
Access
::
NO_ACCESS
]
}
scope
:by_user
,
->
(
user
)
{
where
(
user:
user
)
}
scope
:by_user
,
->
(
user
)
{
where
(
user:
user
)
}
scope
:by_group
,
->
(
group
)
{
where
(
group:
group
)
}
def
self
.
human_access_levels
def
self
.
human_access_levels
{
{
...
...
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