summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-02-07 14:55:42 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2017-02-07 14:58:49 +0100
commitebae38394d8d6738ace1719633ad93c112951f03 (patch)
treeba256bac5a04def9aea317706feea4ae65b36c1c /spec/models
parent99fceff4f9e98cc7cb725882abec6e5b7c9b0170 (diff)
downloadgitlab-ce-ebae38394d8d6738ace1719633ad93c112951f03.tar.gz
Refresh authorizations when transferring projectsrefresh-permissions-when-moving-projects
This ensures that project authorizations are refreshed when moving a project from one namespace to another. When doing so the permissions for all users of both the old and new namespaces are refreshed. See #26194 for more information.
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/group_spec.rb13
-rw-r--r--spec/models/namespace_spec.rb7
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb
index 9ca50555191..a4e6eb4e3a6 100644
--- a/spec/models/group_spec.rb
+++ b/spec/models/group_spec.rb
@@ -300,4 +300,17 @@ describe Group, models: true do
expect(group.members_with_parents).to include(master)
end
end
+
+ describe '#user_ids_for_project_authorizations' do
+ it 'returns the user IDs for which to refresh authorizations' do
+ master = create(:user)
+ developer = create(:user)
+
+ group.add_user(master, GroupMember::MASTER)
+ group.add_user(developer, GroupMember::DEVELOPER)
+
+ expect(group.user_ids_for_project_authorizations).
+ to include(master.id, developer.id)
+ end
+ end
end
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 4e96f19eb6f..7bb1657bc3a 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -218,4 +218,11 @@ describe Namespace, models: true do
expect(group.descendants.to_a).to eq([nested_group, deep_nested_group, very_deep_nested_group])
end
end
+
+ describe '#user_ids_for_project_authorizations' do
+ it 'returns the user IDs for which to refresh authorizations' do
+ expect(namespace.user_ids_for_project_authorizations).
+ to eq([namespace.owner_id])
+ end
+ end
end