mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
feat(RoleForm): service full access.
This commit is contained in:
@@ -64,6 +64,15 @@ function GlobalErrors({
|
||||
},
|
||||
});
|
||||
}
|
||||
if (globalErrors.userInactive) {
|
||||
AppToaster.show({
|
||||
message: 'The authorized user is inactive.',
|
||||
intent: Intent.DANGER,
|
||||
onDismiss: () => {
|
||||
globalErrorsSet({ userInactive: false });
|
||||
},
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export function RoleFormHeader() {
|
||||
|
||||
return (
|
||||
<Card>
|
||||
{/* ---------- name ---------- */}
|
||||
{/* ---------- Name ---------- */}
|
||||
<FastField name={'role_name'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
@@ -39,7 +39,7 @@ export function RoleFormHeader() {
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
{/* ---------- description ---------- */}
|
||||
{/* ---------- Description ---------- */}
|
||||
<FastField name={'role_description'}>
|
||||
{({ field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
|
||||
@@ -85,7 +85,6 @@ function RolesForm({
|
||||
},
|
||||
}) => {
|
||||
setSubmitting(false);
|
||||
|
||||
handleDeleteErrors(errors);
|
||||
};
|
||||
if (isNewMode) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { DATATYPES_LENGTH } from 'common/dataTypes';
|
||||
const Schema = Yup.object().shape({
|
||||
role_name: Yup.string().required().label(intl.get('roles.label.role_name_')),
|
||||
role_description: Yup.string().nullable().max(DATATYPES_LENGTH.TEXT),
|
||||
|
||||
permissions: Yup.object().shape({
|
||||
subject: Yup.string(),
|
||||
ability: Yup.string(),
|
||||
|
||||
@@ -55,10 +55,14 @@ export const transformPermissionsToObject = (permissions) => {
|
||||
* @returns
|
||||
*/
|
||||
export const transformToObject = (role) => {
|
||||
const permissions = transformPermissionsToObject(role.permissions);
|
||||
const serviceFullAccess = getInitialServicesFullAccess(permissions);
|
||||
|
||||
return {
|
||||
role_name: role.name,
|
||||
role_description: role.description,
|
||||
permissions: transformPermissionsToObject(role.permissions),
|
||||
permissions,
|
||||
serviceFullAccess,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -66,6 +66,10 @@ export default function useApiRequest() {
|
||||
if (lockedError) {
|
||||
setGlobalErrors({ transactionsLocked: { ...lockedError.data } });
|
||||
}
|
||||
if (data.errors.find(e => e.type === 'USER_INACTIVE')) {
|
||||
setGlobalErrors({ userInactive: true });
|
||||
setLogout();
|
||||
}
|
||||
}
|
||||
return Promise.reject(error);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user