INSERT INTO SCOPE (ID, API_ID, NAME, DISPLAY_NAME, TENANT_ID, DESCRIPTION)
SELECT LOWER(NEWID()), ID, 'internal_user_association_create', 'Create User Associations', NULL, 'Create the associated local/federated accounts of a user in the organization (root)'
FROM API_RESOURCE
WHERE IDENTIFIER = '/api/users/v1/(.*)/(.*)associations' AND NOT EXISTS (SELECT 1 FROM SCOPE WHERE NAME = 'internal_user_association_create')
/
