diff options
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 |