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
8d5607a8
Commit
8d5607a8
authored
May 05, 2020
by
Imre Farkas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove share_group_with_group feature flag
The feature is default enabled since 12.7.
parent
972c347a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
119 additions
and
298 deletions
+119
-298
app/controllers/groups/group_links_controller.rb
app/controllers/groups/group_links_controller.rb
+0
-5
app/models/group.rb
app/models/group.rb
+0
-2
app/views/groups/group_members/index.html.haml
app/views/groups/group_members/index.html.haml
+9
-13
ee/app/models/ee/group.rb
ee/app/models/ee/group.rb
+0
-4
ee/spec/models/ee/namespace_spec.rb
ee/spec/models/ee/namespace_spec.rb
+34
-99
spec/controllers/groups/group_links_controller_spec.rb
spec/controllers/groups/group_links_controller_spec.rb
+0
-36
spec/features/groups/members/manage_groups_spec.rb
spec/features/groups/members/manage_groups_spec.rb
+33
-52
spec/models/group_spec.rb
spec/models/group_spec.rb
+43
-87
No files found.
app/controllers/groups/group_links_controller.rb
View file @
8d5607a8
# frozen_string_literal: true
class
Groups::GroupLinksController
<
Groups
::
ApplicationController
before_action
:check_feature_flag!
before_action
:authorize_admin_group!
before_action
:group_link
,
only:
[
:update
,
:destroy
]
...
...
@@ -51,8 +50,4 @@ class Groups::GroupLinksController < Groups::ApplicationController
def
group_link_params
params
.
require
(
:group_link
).
permit
(
:group_access
,
:expires_at
)
end
def
check_feature_flag!
render_404
unless
Feature
.
enabled?
(
:share_group_with_group
,
default_enabled:
true
)
end
end
app/models/group.rb
View file @
8d5607a8
...
...
@@ -520,8 +520,6 @@ class Group < Namespace
end
def
max_member_access_for_user_from_shared_groups
(
user
)
return
unless
Feature
.
enabled?
(
:share_group_with_group
,
default_enabled:
true
)
group_group_link_table
=
GroupGroupLink
.
arel_table
group_member_table
=
GroupMember
.
arel_table
...
...
app/views/groups/group_members/index.html.haml
View file @
8d5607a8
...
...
@@ -9,20 +9,16 @@
=
_
(
"Group members"
)
%hr
-
if
can_manage_members
-
if
Feature
.
enabled?
(
:share_group_with_group
,
default_enabled:
true
)
%ul
.nav-links.nav.nav-tabs.gitlab-tabs
{
role:
'tablist'
}
%ul
.nav-links.nav.nav-tabs.gitlab-tabs
{
role:
'tablist'
}
%li
.nav-tab
{
role:
'presentation'
}
%a
.nav-link.active
{
href:
'#invite-member-pane'
,
id:
'invite-member-tab'
,
data:
{
toggle:
'tab'
},
role:
'tab'
}=
_
(
"Invite member"
)
%li
.nav-tab
{
role:
'presentation'
}
%a
.nav-link.active
{
href:
'#invite-member-pane'
,
id:
'invite-member-tab'
,
data:
{
toggle:
'tab'
},
role:
'tab'
}=
_
(
"Invite member"
)
%li
.nav-tab
{
role:
'presentation'
}
%a
.nav-link
{
href:
'#invite-group-pane'
,
id:
'invite-group-tab'
,
data:
{
toggle:
'tab'
,
qa_selector:
'invite_group_tab'
},
role:
'tab'
}=
_
(
"Invite group"
)
.tab-content.gitlab-tab-content
.tab-pane.active
{
id:
'invite-member-pane'
,
role:
'tabpanel'
}
=
render_invite_member_for_group
(
@group
,
@group_member
.
access_level
)
-
if
Feature
.
enabled?
(
:share_group_with_group
,
default_enabled:
true
)
.tab-pane
{
id:
'invite-group-pane'
,
role:
'tabpanel'
}
=
render
'shared/members/invite_group'
,
submit_url:
group_group_links_path
(
@group
),
access_levels:
GroupMember
.
access_level_roles
,
default_access_level:
@group_member
.
access_level
,
group_link_field:
'shared_with_group_id'
,
group_access_field:
'shared_group_access'
-
else
=
render_invite_member_for_group
(
@group
,
@group_member
.
access_level
)
%a
.nav-link
{
href:
'#invite-group-pane'
,
id:
'invite-group-tab'
,
data:
{
toggle:
'tab'
,
qa_selector:
'invite_group_tab'
},
role:
'tab'
}=
_
(
"Invite group"
)
.tab-content.gitlab-tab-content
.tab-pane.active
{
id:
'invite-member-pane'
,
role:
'tabpanel'
}
=
render_invite_member_for_group
(
@group
,
@group_member
.
access_level
)
.tab-pane
{
id:
'invite-group-pane'
,
role:
'tabpanel'
}
=
render
'shared/members/invite_group'
,
submit_url:
group_group_links_path
(
@group
),
access_levels:
GroupMember
.
access_level_roles
,
default_access_level:
@group_member
.
access_level
,
group_link_field:
'shared_with_group_id'
,
group_access_field:
'shared_group_access'
=
render
'shared/members/requests'
,
membership_source:
@group
,
requesters:
@requesters
...
...
ee/app/models/ee/group.rb
View file @
8d5607a8
...
...
@@ -401,14 +401,10 @@ module EE
# Members belonging to Groups invited to collaborate with Groups and Subgroups
def
billed_shared_group_members
return
::
GroupMember
.
none
unless
::
Feature
.
enabled?
(
:share_group_with_group
)
invited_or_shared_group_members
(
invited_group_in_groups
)
end
def
billed_shared_non_guests_group_members
return
::
GroupMember
.
none
unless
::
Feature
.
enabled?
(
:share_group_with_group
)
invited_or_shared_group_members
(
invited_non_guest_group_in_groups
)
end
...
...
ee/spec/models/ee/namespace_spec.rb
View file @
8d5607a8
...
...
@@ -965,61 +965,44 @@ describe Namespace do
shared_group:
group
})
end
context
'when feature is not enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
end
it
'does not include users coming from the shared groups'
,
:aggregate_failures
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
developer
.
id
])
expect
(
shared_group
.
billed_user_ids
).
not_to
include
([
developer
.
id
])
end
it
'includes active users from the shared group to the billed members'
,
:aggregate_failures
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
shared_group_developer
.
id
,
developer
.
id
])
expect
(
shared_group
.
billed_user_ids
).
not_to
include
([
developer
.
id
])
end
context
'when feature is enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
true
)
end
context
'when subgroup invited another group to collaborate'
do
let
(
:another_shared_group
)
{
create
(
:group
)
}
let
(
:another_shared_group_developer
)
{
create
(
:user
)
}
it
'includes active users from the shared group to the billed members'
,
:aggregate_failures
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
shared_group_developer
.
id
,
developer
.
id
])
expect
(
shared_group
.
billed_user_ids
).
not_to
include
([
developer
.
id
])
before
do
another_shared_group
.
add_developer
(
another_shared_group_developer
)
another_shared_group
.
add_guest
(
create
(
:user
))
another_shared_group
.
add_developer
(
create
(
:user
,
:blocked
))
end
context
'when subgroup invited another group to collaborate'
do
let
(
:another_shared_group
)
{
create
(
:group
)
}
let
(
:another_shared_group_developer
)
{
create
(
:user
)
}
context
'when subgroup invites another group as non guest'
do
before
do
another_shared_group
.
add_developer
(
another_shared_group_developer
)
another_shared_group
.
add_guest
(
create
(
:user
))
another_shared_group
.
add_developer
(
create
(
:user
,
:blocked
)
)
subgroup
=
create
(
:group
,
parent:
group
)
create
(
:group_group_link
,
{
shared_with_group:
another_shared_group
,
shared_group:
subgroup
}
)
end
context
'when subgroup invites another group as non guest'
do
before
do
subgroup
=
create
(
:group
,
parent:
group
)
create
(
:group_group_link
,
{
shared_with_group:
another_shared_group
,
shared_group:
subgroup
})
end
it
'includes all the active and non guest users from the shared group'
,
:aggregate_failures
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
shared_group_developer
.
id
,
developer
.
id
,
another_shared_group_developer
.
id
])
expect
(
shared_group
.
billed_user_ids
).
not_to
include
([
developer
.
id
])
expect
(
another_shared_group
.
billed_user_ids
).
not_to
include
([
developer
.
id
,
shared_group_developer
.
id
])
end
it
'includes all the active and non guest users from the shared group'
,
:aggregate_failures
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
shared_group_developer
.
id
,
developer
.
id
,
another_shared_group_developer
.
id
])
expect
(
shared_group
.
billed_user_ids
).
not_to
include
([
developer
.
id
])
expect
(
another_shared_group
.
billed_user_ids
).
not_to
include
([
developer
.
id
,
shared_group_developer
.
id
])
end
end
context
'when subgroup invites another group as guest'
do
before
do
subgroup
=
create
(
:group
,
parent:
group
)
create
(
:group_group_link
,
:guest
,
{
shared_with_group:
another_shared_group
,
shared_group:
subgroup
})
end
context
'when subgroup invites another group as guest'
do
before
do
subgroup
=
create
(
:group
,
parent:
group
)
create
(
:group_group_link
,
:guest
,
{
shared_with_group:
another_shared_group
,
shared_group:
subgroup
})
end
it
'does not includes any user from the shared group from the subgroup'
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
shared_group_developer
.
id
,
developer
.
id
])
end
it
'does not includes any user from the shared group from the subgroup'
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
shared_group_developer
.
id
,
developer
.
id
])
end
end
end
...
...
@@ -1089,25 +1072,9 @@ describe Namespace do
shared_group:
group
})
end
context
'when feature is not enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
end
it
'does not include users coming from the shared groups'
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
developer
.
id
,
guest
.
id
])
end
end
context
'when feature is enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
true
)
end
it
'includes active users from the shared group including guests'
,
:aggregate_failures
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
developer
.
id
,
guest
.
id
,
shared_group_developer
.
id
,
shared_group_guest
.
id
])
expect
(
shared_group
.
billed_user_ids
).
to
match_array
([
shared_group_developer
.
id
,
shared_group_guest
.
id
])
end
it
'includes active users from the shared group including guests'
,
:aggregate_failures
do
expect
(
group
.
billed_user_ids
).
to
match_array
([
developer
.
id
,
guest
.
id
,
shared_group_developer
.
id
,
shared_group_guest
.
id
])
expect
(
shared_group
.
billed_user_ids
).
to
match_array
([
shared_group_developer
.
id
,
shared_group_guest
.
id
])
end
end
end
...
...
@@ -1186,24 +1153,8 @@ describe Namespace do
shared_group:
group
})
end
context
'when feature is not enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
end
it
'does not include users coming from the shared groups'
do
expect
(
group
.
billable_members_count
).
to
eq
(
1
)
end
end
context
'when feature is enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
true
)
end
it
'includes active users from the shared group to the billed members count'
do
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
end
it
'includes active users from the shared group to the billed members count'
do
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
end
end
end
...
...
@@ -1260,24 +1211,8 @@ describe Namespace do
shared_group:
group
})
end
context
'when feature is not enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
end
it
'does not include users coming from the shared groups'
do
expect
(
group
.
billable_members_count
).
to
eq
(
2
)
end
end
context
'when feature is enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
true
)
end
it
'includes active users from the shared group including guests to the billed members count'
do
expect
(
group
.
billable_members_count
).
to
eq
(
4
)
end
it
'includes active users from the shared group including guests to the billed members count'
do
expect
(
group
.
billable_members_count
).
to
eq
(
4
)
end
end
end
...
...
spec/controllers/groups/group_links_controller_spec.rb
View file @
8d5607a8
...
...
@@ -99,18 +99,6 @@ describe Groups::GroupLinksController do
expect
(
flash
[
:alert
]).
to
eq
(
'error'
)
end
end
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
end
it
'renders 404'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
context
'when user does not have access to the group'
do
...
...
@@ -184,18 +172,6 @@ describe Groups::GroupLinksController do
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
end
it
'renders 404'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
describe
'#destroy'
do
...
...
@@ -231,17 +207,5 @@ describe Groups::GroupLinksController do
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
context
'when feature flag is disabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
end
it
'renders 404'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
spec/features/groups/members/manage_groups_spec.rb
View file @
8d5607a8
...
...
@@ -15,75 +15,56 @@ describe 'Groups > Members > Manage groups', :js do
sign_in
(
user
)
end
context
'with share groups with groups feature flag'
do
before
do
stub_feature_flags
(
shared_with_group:
true
)
end
it
'add group to group'
do
visit
group_group_members_path
(
shared_group
)
it
'add group to group'
do
visit
group_group_members_path
(
shared_group
)
add_group
(
shared_with_group
.
id
,
'Reporter'
)
add_group
(
shared_with_group
.
id
,
'Reporter'
)
page
.
within
(
first_row
)
do
expect
(
page
).
to
have_content
(
shared_with_group
.
name
)
expect
(
page
).
to
have_content
(
'Reporter'
)
end
page
.
within
(
first_row
)
do
expect
(
page
).
to
have_content
(
shared_with_group
.
name
)
expect
(
page
).
to
have_content
(
'Reporter'
)
end
end
it
'remove user from group'
do
create
(
:group_group_link
,
shared_group:
shared_group
,
shared_with_group:
shared_with_group
,
group_access:
::
Gitlab
::
Access
::
DEVELOPER
)
visit
group_group_members_path
(
shared_group
)
expect
(
page
).
to
have_content
(
shared_with_group
.
name
)
it
'remove user from group'
do
create
(
:group_group_link
,
shared_group:
shared_group
,
shared_with_group:
shared_with_group
,
group_access:
::
Gitlab
::
Access
::
DEVELOPER
)
accept_confirm
do
find
(
:css
,
'#existing_shares li'
,
text:
shared_with_group
.
name
).
find
(
:css
,
'a.btn-remove'
).
click
end
visit
group_group_members_path
(
shared_group
)
wait_for_requests
expect
(
page
).
to
have_content
(
shared_with_group
.
name
)
expect
(
page
).
not_to
have_content
(
shared_with_group
.
name
)
accept_confirm
do
find
(
:css
,
'#existing_shares li'
,
text:
shared_with_group
.
name
).
find
(
:css
,
'a.btn-remove'
).
click
end
it
'update group to owner level'
do
create
(
:group_group_link
,
shared_group:
shared_group
,
shared_with_group:
shared_with_group
,
group_access:
::
Gitlab
::
Access
::
DEVELOPER
)
wait_for_requests
visit
group_group_members_path
(
shared_group
)
expect
(
page
).
not_to
have_content
(
shared_with_group
.
name
)
end
page
.
within
(
first_row
)
do
click_button
(
'Developer'
)
click_link
(
'Maintainer'
)
it
'update group to owner level'
do
create
(
:group_group_link
,
shared_group:
shared_group
,
shared_with_group:
shared_with_group
,
group_access:
::
Gitlab
::
Access
::
DEVELOPER
)
wait_for_requests
visit
group_group_members_path
(
shared_group
)
expect
(
page
).
to
have_button
(
'Maintainer'
)
end
end
page
.
within
(
first_row
)
do
click_button
(
'Developer'
)
click_link
(
'Maintainer'
)
def
add_group
(
id
,
role
)
page
.
click_link
'Invite group'
page
.
within
".invite-group-form"
do
select2
(
id
,
from:
"#shared_with_group_id"
)
select
(
role
,
from:
"shared_group_access"
)
click_button
"Invite"
end
end
end
wait_for_requests
context
'without share groups with groups feature flag'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
expect
(
page
).
to
have_button
(
'Maintainer'
)
end
end
it
'does not render invitation form and tabs'
do
visit
group_group_members_path
(
shared_group
)
expect
(
page
).
not_to
have_link
(
'Invite member'
)
expect
(
page
).
not_to
have_link
(
'Invite group'
)
def
add_group
(
id
,
role
)
page
.
click_link
'Invite group'
page
.
within
".invite-group-form"
do
select2
(
id
,
from:
"#shared_with_group_id"
)
select
(
role
,
from:
"shared_group_access"
)
click_button
"Invite"
end
end
end
spec/models/group_spec.rb
View file @
8d5607a8
...
...
@@ -560,114 +560,72 @@ describe Group do
group_access:
GroupMember
::
DEVELOPER
})
end
context
'when feature flag share_group_with_group is enabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
true
)
end
context
'with user in the group'
do
let
(
:user
)
{
group_user
}
context
'with user in the group'
do
let
(
:user
)
{
group_user
}
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
DEVELOPER
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
DEVELOPER
)
end
context
'with lower group access level than max access level for share'
do
let
(
:user
)
{
create
(
:user
)
}
it
'returns correct access level'
do
group
.
add_reporter
(
user
)
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
REPORTER
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
REPORTER
)
end
end
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
DEVELOPER
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
DEVELOPER
)
end
context
'with
user in the parent group
'
do
let
(
:user
)
{
parent_group_user
}
context
'with
lower group access level than max access level for share
'
do
let
(
:user
)
{
create
(
:user
)
}
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
end
group
.
add_reporter
(
user
)
context
'with user in the child group'
do
let
(
:user
)
{
child_group_user
}
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
REPORTER
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
REPORTER
)
end
end
end
context
'unrelated project owner'
do
let
(
:common_id
)
{
[
Project
.
maximum
(
:id
).
to_i
,
Namespace
.
maximum
(
:id
).
to_i
].
max
+
999
}
let!
(
:group
)
{
create
(
:group
,
id:
common_id
)
}
let!
(
:unrelated_project
)
{
create
(
:project
,
id:
common_id
)
}
let
(
:user
)
{
unrelated_project
.
owner
}
context
'with user in the parent group'
do
let
(
:user
)
{
parent_group_user
}
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
end
context
'user without accepted access request'
do
let!
(
:user
)
{
create
(
:user
)
}
before
do
create
(
:group_member
,
:developer
,
:access_request
,
user:
user
,
group:
group
)
end
context
'with user in the child group'
do
let
(
:user
)
{
child_group_user
}
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
end
context
'when feature flag share_group_with_group is disabled'
do
before
do
stub_feature_flags
(
share_group_with_group:
false
)
end
context
'with user in the group'
do
let
(
:user
)
{
group_user
}
context
'unrelated project owner'
do
let
(
:common_id
)
{
[
Project
.
maximum
(
:id
).
to_i
,
Namespace
.
maximum
(
:id
).
to_i
].
max
+
999
}
let!
(
:group
)
{
create
(
:group
,
id:
common_id
)
}
let!
(
:unrelated_project
)
{
create
(
:project
,
id:
common_id
)
}
let
(
:user
)
{
unrelated_project
.
owner
}
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
end
context
'with user in the parent group
'
do
let
(
:user
)
{
parent_group_user
}
context
'user without accepted access request
'
do
let!
(
:user
)
{
create
(
:user
)
}
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
before
do
create
(
:group_member
,
:developer
,
:access_request
,
user:
user
,
group:
group
)
end
context
'with user in the child group'
do
let
(
:user
)
{
child_group_user
}
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
it
'returns correct access level'
do
expect
(
shared_group_parent
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
expect
(
shared_group_child
.
max_member_access_for_user
(
user
)).
to
eq
(
Gitlab
::
Access
::
NO_ACCESS
)
end
end
end
...
...
@@ -679,8 +637,6 @@ describe Group do
let
(
:shared_group
)
{
create
(
:group
,
:private
,
parent:
shared_group_parent
)
}
before
do
stub_feature_flags
(
share_group_with_group:
true
)
group
.
add_owner
(
user
)
create
(
:group_group_link
,
{
shared_with_group:
group
,
...
...
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