Merge remote-tracking branch 'origin/main' into auto-capitalization-toggle

This commit is contained in:
Hasan Mansoor
2023-02-05 03:19:06 +03:00
129 changed files with 3586 additions and 1104 deletions
@@ -13,6 +13,7 @@ export interface IMembershipOrg {
organization: string;
role: 'owner' | 'admin' | 'member';
status: 'invited' | 'accepted';
deniedPermissions: any[];
}
/**
* This route lets us get all the users in an org.
@@ -0,0 +1,27 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function change the access of a user in a certain organization
* @param {string} organizationId
* @param {string} membershipId
* @param {string} role
* @returns
*/
const changeUserRoleInOrganization = (organizationId: string, membershipId: string, role: string) =>
SecurityClient.fetchCall(`/api/v2/organizations/${organizationId}/memberships/${membershipId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
role
})
}).then(async (res) => {
if (res && res.status === 200) {
return res;
}
console.log('Failed to change the user role in an org');
return undefined;
});
export default changeUserRoleInOrganization;
@@ -0,0 +1,22 @@
import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get the environments that a certain user has acess to in a certain project
* @param {string} workspaceId
* @returns
*/
const getWorkspaceEnvironments = ({ workspaceId }: { workspaceId: string }) =>
SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
if (res?.status === 200) {
return (await res.json()).accessibleEnvironments;
}
console.log('Failed to get accessible environments');
return undefined;
});
export default getWorkspaceEnvironments;