diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-16 13:42:19 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-16 13:42:19 +0300 |
commit | 84d1bd786125c1c14a3ba5f63e38a4cc736a9027 (patch) | |
tree | f550fa965f507077e20dbb6d61a8269a99ef7107 /app/graphql/resolvers/organizations | |
parent | 3a105e36e689f7b75482236712f1a47fd5a76814 (diff) |
Add latest changes from gitlab-org/gitlab@16-8-stable-eev16.8.0-rc42
Diffstat (limited to 'app/graphql/resolvers/organizations')
-rw-r--r-- | app/graphql/resolvers/organizations/organizations_resolver.rb | 19 | ||||
-rw-r--r-- | app/graphql/resolvers/organizations/projects_resolver.rb | 19 |
2 files changed, 38 insertions, 0 deletions
diff --git a/app/graphql/resolvers/organizations/organizations_resolver.rb b/app/graphql/resolvers/organizations/organizations_resolver.rb new file mode 100644 index 00000000000..ab21a84645b --- /dev/null +++ b/app/graphql/resolvers/organizations/organizations_resolver.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Resolvers + module Organizations + class OrganizationsResolver < BaseResolver + include Gitlab::Graphql::Authorize::AuthorizeResource + + type Types::Organizations::OrganizationType.connection_type, null: true + authorize :read_organization + + def resolve + # For the Organization MVC, all the organizations are public. We need to change this to only accessible + # organizations once we start supporting private organizations. + # See https://gitlab.com/groups/gitlab-org/-/epics/10649. + ::Organizations::Organization.all + end + end + end +end diff --git a/app/graphql/resolvers/organizations/projects_resolver.rb b/app/graphql/resolvers/organizations/projects_resolver.rb new file mode 100644 index 00000000000..836fe0ae059 --- /dev/null +++ b/app/graphql/resolvers/organizations/projects_resolver.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Resolvers + module Organizations + class ProjectsResolver < BaseResolver + include Gitlab::Graphql::Authorize::AuthorizeResource + + type Types::ProjectType, null: true + + authorize :read_project + + alias_method :organization, :object + + def resolve + ::ProjectsFinder.new(current_user: current_user, params: { organization: organization }).execute + end + end + end +end |