> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateTeamMemberAssignments # Package: accounts # Namespace: RolesManagementService # Method link: https://dev.wix.com/docs/api-reference/account-level/user-management/accounts/users/update-team-member-assignments.md ## Permission Scopes: Manage Team Members: SCOPE.IDENTITY.MANAGE-TEAM-MEMBERS ## Introduction Updates the assignments of roles and conditions for an existing team member. Changing assignments changes the team member’s access to account assets. > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. --- ## REST API ### Schema ``` Method: updateTeamMemberAssignments Description: Updates the assignments of roles and conditions for an existing team member. Changing assignments changes the team member’s access to account assets. > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. URL: https://www.wixapis.com/roles-management/v2/team/assignments Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: userId, newAssignments, assignmentIdsToRemove Method parameters: param name: assignmentIdsToRemove | type: array | description: Existing assignment GUIDs to remove. To retrieve all existing assignment GUIDs for a team member, call Search Team. | required: true param name: newAssignments | type: array | description: New assignments to apply to the team member in this account. | required: true - name: policyId | type: string | description: Role assigned to the user. To retrieve all available roles, call Get Roles Info. - name: restrictions | type: Restriction | description: The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders. - ONE-OF: - name: conditions | type: Conditions | description: List of conditions restricting the user's access. Currently only folder conditions are supported. - name: conditions | type: array | description: List of conditions. - name: conditionType | type: ConditionAttributeType | description: Condition type. - enum: UNKNOWN_CONDITION_TYPE, FOLDER - name: id | type: string | description: Condition GUID. - name: value | type: string | description: Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path. - name: site | type: SiteRestriction | description: Site where the assignment restrictions apply. - name: id | type: string | description: Site GUID. - name: value | type: string | description: Site name. - name: locations | type: LocationsRestriction | description: Business locations where the assignment restrictions apply. Get location GUIDs from the [Locations API](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). - name: ids | type: array | description: Location GUIDs where the assignment restrictions apply. - name: subject | type: AssignedSubject | description: Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user GUIDs, account GUIDs, and app GUIDs. - name: subjectType | type: SubjectType | description: Identity type. - enum: UNKNOWN, ACCOUNT, USER, USER_GROUP, MEMBER_GROUP, VISITOR_GROUP, EXTERNAL_APP, ACCOUNT_GROUP, WIX_APP param name: userId | type: userId | description: GUID of team member being affected. | required: true Return type: UpdateTeamMemberAssignmentsResponse - name: assignments | type: array | description: The new assignments, assigned to the given team member. - name: policyId | type: string | description: Role assigned to the user. To retrieve all available roles, call Get Roles Info. - name: assignmentId | type: string | description: Unique GUID for this specific assignment. - name: restrictions | type: Restriction | description: The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders. - ONE-OF: - name: conditions | type: Conditions | description: List of conditions restricting the user's access. Currently only folder conditions are supported. - name: conditions | type: array | description: List of conditions. - name: conditionType | type: ConditionAttributeType | description: Condition type. - enum: UNKNOWN_CONDITION_TYPE, FOLDER - name: id | type: string | description: Condition GUID. - name: value | type: string | description: Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path. - name: site | type: SiteRestriction | description: Site where the assignment restrictions apply. - name: id | type: string | description: Site GUID. - name: value | type: string | description: Site name. - name: locations | type: LocationsRestriction | description: Business locations where the assignment restrictions apply. Get location GUIDs from the [Locations API](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). - name: ids | type: array | description: Location GUIDs where the assignment restrictions apply. - name: subject | type: AssignedSubject | description: Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user GUIDs, account GUIDs, and app GUIDs. - name: id | type: string | description: Identity GUID. - name: subjectType | type: SubjectType | description: Identity type. - enum: UNKNOWN, ACCOUNT, USER, USER_GROUP, MEMBER_GROUP, VISITOR_GROUP, EXTERNAL_APP, ACCOUNT_GROUP, WIX_APP ``` ### Examples ### Update assignments ```curl curl -X PATCH \ 'https://www.wixapis.com/roles-management/v2/team/assignments' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "userId": "fed9597b-00a1-4bd6-0000-aff2ec248e7a", "newAssignments": [ { "policyId": "6600344420111308827" } ], "assignmentIdsToRemove": [ "7167886595789334551" ] }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.accounts.RolesManagementService.updateTeamMemberAssignments(userId, options) Description: Updates the assignments of roles and conditions for an existing team member. Changing assignments changes the team member’s access to account assets. > **Important**: This call requires an account level API key and cannot be authenticated with the standard authorization header. API keys are currently available to selected beta users only. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: userId, options.newAssignments, options.assignmentIdsToRemove, options Method parameters: param name: options | type: UpdateTeamMemberAssignmentsOptions none | required: true - name: newAssignments | type: array | description: New assignments to apply to the team member in this account. | required: true - name: policyId | type: string | description: Role assigned to the user. To retrieve all available roles, call Get Roles Info. - name: restrictions | type: Restriction | description: The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders. - ONE-OF: - name: conditions | type: Conditions | description: List of conditions restricting the user's access. Currently only folder conditions are supported. - name: conditions | type: array | description: List of conditions. - name: conditionType | type: ConditionAttributeType | description: Condition type. - enum: UNKNOWN_CONDITION_TYPE, FOLDER - name: _id | type: string | description: Condition GUID. - name: value | type: string | description: Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path. - name: site | type: SiteRestriction | description: Site where the assignment restrictions apply. - name: _id | type: string | description: Site GUID. - name: value | type: string | description: Site name. - name: locations | type: LocationsRestriction | description: Business locations where the assignment restrictions apply. Get location GUIDs from the [Locations API](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). - name: ids | type: array | description: Location GUIDs where the assignment restrictions apply. - name: subject | type: AssignedSubject | description: Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user GUIDs, account GUIDs, and app GUIDs. - name: subjectType | type: SubjectType | description: Identity type. - enum: UNKNOWN, ACCOUNT, USER, USER_GROUP, MEMBER_GROUP, VISITOR_GROUP, EXTERNAL_APP, ACCOUNT_GROUP, WIX_APP - name: assignmentIdsToRemove | type: array | description: Existing assignment GUIDs to remove. To retrieve all existing assignment GUIDs for a team member, call Search Team. | required: true param name: userId | type: string | description: GUID of team member being affected. | required: true Return type: PROMISE - name: assignments | type: array | description: The new assignments, assigned to the given team member. - name: policyId | type: string | description: Role assigned to the user. To retrieve all available roles, call Get Roles Info. - name: assignmentId | type: string | description: Unique GUID for this specific assignment. - name: restrictions | type: Restriction | description: The asset where a user is assigned access in an assignment. When empty, the role covers all assets, with no restrictions to specific sites or folders. - ONE-OF: - name: conditions | type: Conditions | description: List of conditions restricting the user's access. Currently only folder conditions are supported. - name: conditions | type: array | description: List of conditions. - name: conditionType | type: ConditionAttributeType | description: Condition type. - enum: UNKNOWN_CONDITION_TYPE, FOLDER - name: _id | type: string | description: Condition GUID. - name: value | type: string | description: Expected value of the condition. When `conditionType` = "FOLDER", this is the folder path. - name: site | type: SiteRestriction | description: Site where the assignment restrictions apply. - name: _id | type: string | description: Site GUID. - name: value | type: string | description: Site name. - name: locations | type: LocationsRestriction | description: Business locations where the assignment restrictions apply. Get location GUIDs from the [Locations API](https://dev.wix.com/docs/api-reference/business-management/locations/introduction.md). - name: ids | type: array | description: Location GUIDs where the assignment restrictions apply. - name: subject | type: AssignedSubject | description: Identity assigned to the asset in an assignment, referred to as subject. Supported subjects include user GUIDs, account GUIDs, and app GUIDs. - name: _id | type: string | description: Identity GUID. - name: subjectType | type: SubjectType | description: Identity type. - enum: UNKNOWN, ACCOUNT, USER, USER_GROUP, MEMBER_GROUP, VISITOR_GROUP, EXTERNAL_APP, ACCOUNT_GROUP, WIX_APP ``` ### Examples ### Update a team member's assignments with an API key ```javascript import { createClient, ApiKeyStrategy } from "@wix/sdk"; import { users } from "@wix/user-management"; const wixClient = createClient({ modules: { users }, auth: ApiKeyStrategy({ apiKey: "MY-API-KEY", }), }); async function updateTeamMemberAssignments(userId, options) { const response = await users.updateTeamMemberAssignments(userId, options); } ``` ### updateTeamMemberAssignments (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { users } from '@wix/user-management'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { users }, // Include the auth strategy and host as relevant }); async function updateTeamMemberAssignments(userId,options) { const response = await myWixClient.users.updateTeamMemberAssignments(userId,options); }; ``` ---