diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/users/profile/actions/components/user_actions_app.vue | 8 | ||||
-rw-r--r-- | app/controllers/projects/raw_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/projects/repositories_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/repositories/git_http_client_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/repositories/lfs_api_controller.rb | 4 | ||||
-rw-r--r-- | app/models/guest.rb | 9 | ||||
-rw-r--r-- | app/models/users/anonymous.rb | 11 |
7 files changed, 24 insertions, 15 deletions
diff --git a/app/assets/javascripts/users/profile/actions/components/user_actions_app.vue b/app/assets/javascripts/users/profile/actions/components/user_actions_app.vue index 5dfa9c67852..f994cad6881 100644 --- a/app/assets/javascripts/users/profile/actions/components/user_actions_app.vue +++ b/app/assets/javascripts/users/profile/actions/components/user_actions_app.vue @@ -83,7 +83,13 @@ export default { <template> <span> - <gl-disclosure-dropdown icon="ellipsis_v" category="tertiary" no-caret :items="dropdownItems" /> + <gl-disclosure-dropdown + data-testid="user-profile-actions" + icon="ellipsis_v" + category="tertiary" + no-caret + :items="dropdownItems" + /> <abuse-category-selector v-if="reportedUserId" :reported-user-id="reportedUserId" diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb index 79b5990abba..d0a80c6aa07 100644 --- a/app/controllers/projects/raw_controller.rb +++ b/app/controllers/projects/raw_controller.rb @@ -19,7 +19,8 @@ class Projects::RawController < Projects::ApplicationController def show @blob = @repository.blob_at(@ref, @path, limit: Gitlab::Git::Blob::LFS_POINTER_MAX_SIZE) - send_blob(@repository, @blob, inline: (params[:inline] != 'false'), allow_caching: Guest.can?(:read_code, @project)) + send_blob(@repository, @blob, inline: (params[:inline] != 'false'), allow_caching: +::Users::Anonymous.can?(:read_code, @project)) end private diff --git a/app/controllers/projects/repositories_controller.rb b/app/controllers/projects/repositories_controller.rb index 4a9282432fd..406e3bd62c2 100644 --- a/app/controllers/projects/repositories_controller.rb +++ b/app/controllers/projects/repositories_controller.rb @@ -48,7 +48,7 @@ class Projects::RepositoriesController < Projects::ApplicationController expires_in( cache_max_age(commit_id), - public: Guest.can?(:download_code, project), + public: ::Users::Anonymous.can?(:download_code, project), must_revalidate: true, stale_if_error: 5.minutes, stale_while_revalidate: 1.minute, diff --git a/app/controllers/repositories/git_http_client_controller.rb b/app/controllers/repositories/git_http_client_controller.rb index a5ca17db113..71d8ad829f6 100644 --- a/app/controllers/repositories/git_http_client_controller.rb +++ b/app/controllers/repositories/git_http_client_controller.rb @@ -142,7 +142,7 @@ module Repositories Gitlab::ProtocolAccess.allowed?('http') && download_request? && container && - Guest.can?(repo_type.guest_read_ability, container) + ::Users::Anonymous.can?(repo_type.guest_read_ability, container) end def bypass_admin_mode!(&block) diff --git a/app/controllers/repositories/lfs_api_controller.rb b/app/controllers/repositories/lfs_api_controller.rb index d9ca216b168..d9d3753a2ff 100644 --- a/app/controllers/repositories/lfs_api_controller.rb +++ b/app/controllers/repositories/lfs_api_controller.rb @@ -60,7 +60,7 @@ module Repositories .for_oids(objects_oids) .index_by(&:oid) - guest_can_download = Guest.can?(:download_code, project) + guest_can_download = ::Users::Anonymous.can?(:download_code, project) objects.each do |object| if lfs_object = existing_oids[object[:oid]] @@ -87,7 +87,7 @@ module Repositories if existing_oids.include?(object[:oid]) object[:actions] = proxy_download_actions(object) - if Guest.can?(:download_code, project) + if ::Users::Anonymous.can?(:download_code, project) object[:authenticated] = true end else diff --git a/app/models/guest.rb b/app/models/guest.rb deleted file mode 100644 index 9c8097e1ac8..00000000000 --- a/app/models/guest.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Guest - class << self - def can?(action, subject = :global) - Ability.allowed?(nil, action, subject) - end - end -end diff --git a/app/models/users/anonymous.rb b/app/models/users/anonymous.rb new file mode 100644 index 00000000000..b4a182ba203 --- /dev/null +++ b/app/models/users/anonymous.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Users + class Anonymous + class << self + def can?(action, subject = :global) + Ability.allowed?(nil, action, subject) + end + end + end +end |