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
Boxiang Sun
gitlab-ce
Commits
0f3c3a1c
Commit
0f3c3a1c
authored
Nov 21, 2016
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update user's authorized projects if project is allowed to share with group
parent
91633281
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
app/models/group.rb
app/models/group.rb
+3
-1
app/models/namespace.rb
app/models/namespace.rb
+8
-0
No files found.
app/models/group.rb
View file @
0f3c3a1c
...
@@ -65,7 +65,9 @@ class Group < Namespace
...
@@ -65,7 +65,9 @@ class Group < Namespace
def
select_for_project_authorization
def
select_for_project_authorization
if
current_scope
.
joins_values
.
include?
(
:shared_projects
)
if
current_scope
.
joins_values
.
include?
(
:shared_projects
)
select
(
"members.user_id, projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level"
)
joins
(
'INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id'
)
.
where
(
'project_namespace.share_with_group_lock = ?'
,
false
)
.
select
(
"members.user_id, projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level"
)
else
else
super
super
end
end
...
...
app/models/namespace.rb
View file @
0f3c3a1c
...
@@ -27,6 +27,7 @@ class Namespace < ActiveRecord::Base
...
@@ -27,6 +27,7 @@ class Namespace < ActiveRecord::Base
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
after_update
:move_dir
,
if: :path_changed?
after_update
:move_dir
,
if: :path_changed?
after_commit
:refresh_access_of_projects_invited_groups
,
on: :update
,
if:
->
{
previous_changes
.
key?
(
'share_with_group_lock'
)
}
# Save the storage paths before the projects are destroyed to use them on after destroy
# Save the storage paths before the projects are destroyed to use them on after destroy
before_destroy
(
prepend:
true
)
{
@old_repository_storage_paths
=
repository_storage_paths
}
before_destroy
(
prepend:
true
)
{
@old_repository_storage_paths
=
repository_storage_paths
}
...
@@ -175,4 +176,11 @@ class Namespace < ActiveRecord::Base
...
@@ -175,4 +176,11 @@ class Namespace < ActiveRecord::Base
end
end
end
end
end
end
def
refresh_access_of_projects_invited_groups
Group
.
joins
(
project_group_links: :project
).
where
(
projects:
{
namespace_id:
id
}).
find_each
(
&
:refresh_members_authorized_projects
)
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