diff options
Diffstat (limited to 'app/graphql/types/branch_protections')
3 files changed, 44 insertions, 0 deletions
diff --git a/app/graphql/types/branch_protections/base_access_level_type.rb b/app/graphql/types/branch_protections/base_access_level_type.rb new file mode 100644 index 00000000000..472733a6bc5 --- /dev/null +++ b/app/graphql/types/branch_protections/base_access_level_type.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module Types + module BranchProtections + class BaseAccessLevelType < Types::BaseObject + authorize :read_protected_branch + + field :access_level, + type: GraphQL::Types::Int, + null: false, + description: 'GitLab::Access level.' + + field :access_level_description, + type: GraphQL::Types::String, + null: false, + description: 'Human readable representation for this access level.', + hash_key: 'humanize' + end + end +end + +Types::BranchProtections::BaseAccessLevelType.prepend_mod diff --git a/app/graphql/types/branch_protections/merge_access_level_type.rb b/app/graphql/types/branch_protections/merge_access_level_type.rb new file mode 100644 index 00000000000..85295e1ba25 --- /dev/null +++ b/app/graphql/types/branch_protections/merge_access_level_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Types + module BranchProtections + class MergeAccessLevelType < BaseAccessLevelType # rubocop:disable Graphql/AuthorizeTypes + graphql_name 'MergeAccessLevel' + description 'Represents the merge access level of a branch protection.' + accepts ::ProtectedBranch::MergeAccessLevel + end + end +end diff --git a/app/graphql/types/branch_protections/push_access_level_type.rb b/app/graphql/types/branch_protections/push_access_level_type.rb new file mode 100644 index 00000000000..bfbdc4edbea --- /dev/null +++ b/app/graphql/types/branch_protections/push_access_level_type.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Types + module BranchProtections + class PushAccessLevelType < BaseAccessLevelType # rubocop:disable Graphql/AuthorizeTypes + graphql_name 'PushAccessLevel' + description 'Represents the push access level of a branch protection.' + accepts ::ProtectedBranch::PushAccessLevel + end + end +end |