-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ISSUE-7985: The topics for the "Company User" mutations have been cre… #8104
Changes from 2 commits
95f991e
be51581
64ab872
a05d0f2
22b5d5d
0f79a2c
698c8db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,187 @@ | ||||||
| --- | ||||||
| group: graphql | ||||||
| title: createCompanyUser mutation | ||||||
| contributor_name: Atwix | ||||||
| contributor_link: https://www.atwix.com/ | ||||||
| b2b_only: true | ||||||
| --- | ||||||
|
|
||||||
| The createCompanyUser mutation allows an existing company user with the role contained "Magento_Company::users_edit" permission to create a new company user. The specified email address determines how Magento processes the request. | ||||||
|
|
||||||
| If the email address is unique for the website?/store?/store view?, Magento immediately creates the company user. | ||||||
|
||||||
|
|
||||||
| If the email address belongs to a customer who is not a company user, Magento sends an invitation to join the company organization to the customer. When the customer accepts the invitation, Magento adds the customer to the company organization. | ||||||
|
|
||||||
| If the email address belongs to an existing company user with the same company, Magento returns the error "A customer with the same email already assigned to company". | ||||||
|
|
||||||
| If the email address belongs to a customer who is part of another company organization, Magento returns the error "A customer with the same email already assigned to company". | ||||||
|
||||||
|
|
||||||
| The `target_id` input attribute allows you to specify which node in the company structure will be the parent node of the company user. If you do not specify a value, the user will be assigned to the top-level (root) node of the company structure. | ||||||
|
|
||||||
| You can get the `target_id` and the `role_id` with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query. | ||||||
|
|
||||||
| ## Syntax | ||||||
|
|
||||||
| ```graphql | ||||||
| mutation { | ||||||
| createCompanyUser( | ||||||
| input: CompanyUserCreateInput! | ||||||
| ) { | ||||||
| CreateCompanyUserOutput | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ## Example usage | ||||||
|
|
||||||
| The following example shows the minimal payload to add a company user. Because a `targit_id` is not specified, Magento places the new company user at the top node of the company structure. | ||||||
|
||||||
| The following example shows the minimal payload to add a company user. Because a `targit_id` is not specified, Magento places the new company user at the top node of the company structure. | |
| The following example shows the minimal payload to add a company user. Because a `target_id` is not specified, Magento places the new company user at the top node of the company structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. This is typo.
Thank you @rogyar
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
telephone isn't in alphabetical order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have information about the default target ID (if not specified explicitly)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @rogyar
Thank you for your review.
It is described in the top paragraphs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the preferred method of documenting non-intuitive attributes and objects. The descriptions here should be very similar to the @description text in the schema file. Eventually, the GraphQL documentation will be auto-generated, and we don't want to lose critical information.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,76 @@ | ||||||
| --- | ||||||
| group: graphql | ||||||
| title: deleteCompanyUser mutation | ||||||
| contributor_name: Atwix | ||||||
| contributor_link: https://www.atwix.com/ | ||||||
| b2b_only: true | ||||||
| --- | ||||||
|
|
||||||
| Use the `deleteCompanyUser` mutation to deactivate the specified company user. | ||||||
|
|
||||||
| You can get the user ID with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query. | ||||||
|
|
||||||
| ## Syntax | ||||||
|
|
||||||
| ```graphql | ||||||
| mutation { | ||||||
| deleteCompanyUser( | ||||||
| id: ID! | ||||||
| ) { | ||||||
| DeleteCompanyUserOutput | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ## Example usage | ||||||
|
|
||||||
| The following example deactivates the user specified in the `id` attribute. | ||||||
|
|
||||||
| **Request:** | ||||||
|
|
||||||
| ```graphql | ||||||
| mutation { | ||||||
| deleteCompanyUser( | ||||||
| id: "Mg==" | ||||||
| ) { | ||||||
| success | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| **Response:** | ||||||
|
|
||||||
| ```json | ||||||
| { | ||||||
| "data": { | ||||||
| "deleteCompanyUser": { | ||||||
| "success": true | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ## Input attributes | ||||||
|
|
||||||
| The `deleteCompanyUser` mutation requires the following input: | ||||||
|
|
||||||
| Attribute | Data Type | Description | ||||||
| --- | --- | --- | ||||||
| `id` | ID! | The encoded user ID to deactivate | ||||||
|
|
||||||
| ## Output attributes | ||||||
|
|
||||||
| The `deleteCompanyUser` mutation returns a Boolean value that indicates whether the operation was successful. | ||||||
|
|
||||||
| Attribute | Data Type | Description | ||||||
| --- | --- | --- | ||||||
| `success` | Boolean! | A value of `true` indicates the company user has been deactivated successfully, otherwise a value returns `false` | ||||||
|
|
||||||
| ## Errors | ||||||
|
|
||||||
| Error | Description | ||||||
| --- | --- | ||||||
| `You do not have authorization to perform this action.` | The user with ID provided in the `input`.`id` argument not available to your company, or you do not have the necessary permissions to perform this operation. | ||||||
|
||||||
| `You do not have authorization to perform this action.` | The user with ID provided in the `input`.`id` argument not available to your company, or you do not have the necessary permissions to perform this operation. | |
| `You do not have authorization to perform this action.` | The user with the ID provided in the `input`.`id` argument is not available to your company, or you do not have the necessary permissions to perform this operation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.