diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /app/controllers/groups | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'app/controllers/groups')
4 files changed, 28 insertions, 30 deletions
diff --git a/app/controllers/groups/group_links_controller.rb b/app/controllers/groups/group_links_controller.rb index 23daa29ac43..52ee69edaa5 100644 --- a/app/controllers/groups/group_links_controller.rb +++ b/app/controllers/groups/group_links_controller.rb @@ -1,7 +1,6 @@ # 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 diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index 664c58e8b7a..63311ab983b 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -21,19 +21,26 @@ class Groups::GroupMembersController < Groups::ApplicationController def index @sort = params[:sort].presence || sort_value_name + @project = @group.projects.find(params[:project_id]) if params[:project_id] - @members = find_members + + @members = GroupMembersFinder + .new(@group, current_user, params: filter_params) + .execute(include_relations: requested_relations) if can_manage_members @skip_groups = @group.related_group_ids - @invited_members = present_invited_members(@members) + + @invited_members = @members.invite + @invited_members = @invited_members.search_invite_email(params[:search_invited]) if params[:search_invited].present? + @invited_members = present_invited_members(@invited_members) end - @members = @members.non_invite - @members = present_group_members(@members) + @members = present_group_members(@members.non_invite) @requesters = present_members( - AccessRequestsFinder.new(@group).execute(current_user)) + AccessRequestsFinder.new(@group).execute(current_user) + ) @group_member = @group.group_members.new end @@ -43,30 +50,24 @@ class Groups::GroupMembersController < Groups::ApplicationController private - def present_invited_members(members) - invited_members = members.invite - - if params[:search_invited].present? - invited_members = invited_members.search_invite_email(params[:search_invited]) - end - - present_members(invited_members - .page(params[:invited_members_page]) - .per(MEMBER_PER_PAGE_LIMIT)) + def can_manage_members + can?(current_user, :admin_group_member, @group) end - def find_members - filter_params = params.slice(:two_factor, :search).merge(sort: @sort) - GroupMembersFinder.new(@group, current_user, params: filter_params).execute(include_relations: requested_relations) + def present_invited_members(invited_members) + present_members(invited_members + .page(params[:invited_members_page]) + .per(MEMBER_PER_PAGE_LIMIT)) end - def can_manage_members - can?(current_user, :admin_group_member, @group) + def present_group_members(members) + present_members(members + .page(params[:page]) + .per(MEMBER_PER_PAGE_LIMIT)) end - def present_group_members(original_members) - members = original_members.page(params[:page]).per(MEMBER_PER_PAGE_LIMIT) - present_members(members) + def filter_params + params.permit(:two_factor, :search).merge(sort: @sort) end end diff --git a/app/controllers/groups/registry/repositories_controller.rb b/app/controllers/groups/registry/repositories_controller.rb index 16aa6e50320..14651e0794a 100644 --- a/app/controllers/groups/registry/repositories_controller.rb +++ b/app/controllers/groups/registry/repositories_controller.rb @@ -9,7 +9,9 @@ module Groups respond_to do |format| format.html format.json do - @images = ContainerRepositoriesFinder.new(user: current_user, subject: group).execute.with_api_entity_associations + @images = ContainerRepositoriesFinder.new(user: current_user, subject: group, params: params.slice(:name)) + .execute + .with_api_entity_associations track_event(:list_repositories) diff --git a/app/controllers/groups/settings/repository_controller.rb b/app/controllers/groups/settings/repository_controller.rb index 6e8c5628d24..4af5e613296 100644 --- a/app/controllers/groups/settings/repository_controller.rb +++ b/app/controllers/groups/settings/repository_controller.rb @@ -46,7 +46,7 @@ module Groups end def deploy_token_params - params.require(:deploy_token).permit(:name, :expires_at, :read_repository, :read_registry, :write_registry, :username) + params.require(:deploy_token).permit(:name, :expires_at, :read_repository, :read_registry, :write_registry, :read_package_registry, :write_package_registry, :username) end end end |