<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/gitlab/gitlab-ce.git/config/initializers/graphql.rb, branch lib-differences</title>
<subtitle>gitlab.com: gitlab-org/gitlab-ce.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/'/>
<entry>
<title>GraphQL Type authorization</title>
<updated>2019-04-03T01:36:33+00:00</updated>
<author>
<name>Luke Duncalfe</name>
<email>lduncalfe@eml.cc</email>
</author>
<published>2019-03-04T02:30:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=8207f7877fea6987cbd8ef26e6f01feca6608bd2'/>
<id>8207f7877fea6987cbd8ef26e6f01feca6608bd2</id>
<content type='text'>
Enables authorizations to be defined on GraphQL Types.

    module Types
      class ProjectType &lt; BaseObject
        authorize :read_project
      end
    end

If a field has authorizations defined on it, and the return type of the
field also has authorizations defined on it. then all of the combined
permissions in the authorizations will be checked and must pass.

Connection fields are checked by "digging" to find the type class of the
"node" field in the expected location of edges-&gt;node.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54417
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Enables authorizations to be defined on GraphQL Types.

    module Types
      class ProjectType &lt; BaseObject
        authorize :read_project
      end
    end

If a field has authorizations defined on it, and the return type of the
field also has authorizations defined on it. then all of the combined
permissions in the authorizations will be checked and must pass.

Connection fields are checked by "digging" to find the type class of the
"node" field in the expected location of edges-&gt;node.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54417
</pre>
</div>
</content>
</entry>
<entry>
<title>Types::BaseField accepts authorize after reload</title>
<updated>2019-03-04T10:19:28+00:00</updated>
<author>
<name>Bob Van Landuyt</name>
<email>bob@vanlanduyt.co</email>
</author>
<published>2019-03-01T17:30:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=58aaa766a44b8b2105f59bf7fcc5a26447bdf286'/>
<id>58aaa766a44b8b2105f59bf7fcc5a26447bdf286</id>
<content type='text'>
When working on files in `app/graphql` the code correctly gets
autoloaded.

However, the redefined `Types::BaseField` would never receive the
`.accepts_definition` call, causing all queries after a reload to
fail. Calling `.accepts_definition` on its superclass makes sure the
reloaded version also has the `authorize` definition specified.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When working on files in `app/graphql` the code correctly gets
autoloaded.

However, the redefined `Types::BaseField` would never receive the
`.accepts_definition` call, causing all queries after a reload to
fail. Calling `.accepts_definition` on its superclass makes sure the
reloaded version also has the `authorize` definition specified.
</pre>
</div>
</content>
</entry>
<entry>
<title>Improve GraphQL Authorization DSL</title>
<updated>2019-02-25T21:22:12+00:00</updated>
<author>
<name>Luke Duncalfe</name>
<email>lduncalfe@eml.cc</email>
</author>
<published>2019-02-18T01:19:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/gitlab/gitlab-ce.git/commit/?id=ccb4edbca1aa7e94a76a5a8d361af02fd093e1b9'/>
<id>ccb4edbca1aa7e94a76a5a8d361af02fd093e1b9</id>
<content type='text'>
Previously GraphQL field authorization happened like this:

    class ProjectType
      field :my_field, MyFieldType do
        authorize :permission
      end
    end

This change allowed us to authorize like this instead:

    class ProjectType
      field :my_field, MyFieldType, authorize: :permission
    end

A new initializer registers the `authorize` metadata keyword on GraphQL
Schema Objects and Fields, and we can collect this data within the
context of Instrumentation like this:

    field.metadata[:authorize]

The previous functionality of authorize is still being used for
mutations, as the #authorize method here is called at during the code
that executes during the mutation, rather than when a field resolves.

https://gitlab.com/gitlab-org/gitlab-ce/issues/57828
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously GraphQL field authorization happened like this:

    class ProjectType
      field :my_field, MyFieldType do
        authorize :permission
      end
    end

This change allowed us to authorize like this instead:

    class ProjectType
      field :my_field, MyFieldType, authorize: :permission
    end

A new initializer registers the `authorize` metadata keyword on GraphQL
Schema Objects and Fields, and we can collect this data within the
context of Instrumentation like this:

    field.metadata[:authorize]

The previous functionality of authorize is still being used for
mutations, as the #authorize method here is called at during the code
that executes during the mutation, rather than when a field resolves.

https://gitlab.com/gitlab-org/gitlab-ce/issues/57828
</pre>
</div>
</content>
</entry>
</feed>
