Role page various fixes 2 (#12416)
- Fix: AvatarURL signedPath for workspace members were not consistent when queried multiple times and it was causing the frontend to wrongly interpret this as a change in the deepEqual condition - Use SaveAndCancel button to be consistent with data model page - When applying all object permission changes, a "smarter" logic applies and removes all permissions if read is unchecked for example - Hide settings permissions when Settings All Access is toggled
This commit is contained in:
@ -82,7 +82,13 @@ export const SettingsRolePermissionsObjectLevelSection = ({
|
||||
...(draftRole.objectPermissions ?? []).filter(
|
||||
(permission) => permission.objectMetadataId !== objectMetadataId,
|
||||
),
|
||||
{ objectMetadataId, roleId },
|
||||
{
|
||||
objectMetadataId,
|
||||
canReadObjectRecords: null,
|
||||
canUpdateObjectRecords: null,
|
||||
canSoftDeleteObjectRecords: null,
|
||||
canDestroyObjectRecords: null,
|
||||
},
|
||||
],
|
||||
}));
|
||||
navigate(SettingsPath.RoleObjectLevel, {
|
||||
|
||||
@ -47,6 +47,13 @@ export const SettingsRolePermissionsObjectsSection = ({
|
||||
setSettingsDraftRole({
|
||||
...settingsDraftRole,
|
||||
canReadAllObjectRecords: value,
|
||||
...(value === false
|
||||
? {
|
||||
canUpdateAllObjectRecords: value,
|
||||
canSoftDeleteAllObjectRecords: value,
|
||||
canDestroyAllObjectRecords: value,
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
},
|
||||
},
|
||||
@ -64,6 +71,11 @@ export const SettingsRolePermissionsObjectsSection = ({
|
||||
setSettingsDraftRole({
|
||||
...settingsDraftRole,
|
||||
canUpdateAllObjectRecords: value,
|
||||
...(value === true
|
||||
? {
|
||||
canReadAllObjectRecords: value,
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
},
|
||||
},
|
||||
@ -81,6 +93,11 @@ export const SettingsRolePermissionsObjectsSection = ({
|
||||
setSettingsDraftRole({
|
||||
...settingsDraftRole,
|
||||
canSoftDeleteAllObjectRecords: value,
|
||||
...(value === true
|
||||
? {
|
||||
canReadAllObjectRecords: value,
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
},
|
||||
},
|
||||
@ -98,6 +115,11 @@ export const SettingsRolePermissionsObjectsSection = ({
|
||||
setSettingsDraftRole({
|
||||
...settingsDraftRole,
|
||||
canDestroyAllObjectRecords: value,
|
||||
...(value === true
|
||||
? {
|
||||
canReadAllObjectRecords: value,
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@ -16,7 +16,7 @@ import {
|
||||
IconSettings,
|
||||
IconUsers,
|
||||
} from 'twenty-ui/display';
|
||||
import { Card, Section } from 'twenty-ui/layout';
|
||||
import { AnimatedExpandableContainer, Card, Section } from 'twenty-ui/layout';
|
||||
import {
|
||||
FeatureFlagKey,
|
||||
SettingPermissionType,
|
||||
@ -112,19 +112,30 @@ export const SettingsRolePermissionsSettingsSection = ({
|
||||
/>
|
||||
</StyledCard>
|
||||
)}
|
||||
<StyledTable>
|
||||
<SettingsRolePermissionsSettingsTableHeader />
|
||||
<StyledTableRows>
|
||||
{settingsPermissionsConfig.map((permission) => (
|
||||
<SettingsRolePermissionsSettingsTableRow
|
||||
key={permission.key}
|
||||
roleId={roleId}
|
||||
permission={permission}
|
||||
isEditable={isEditable}
|
||||
/>
|
||||
))}
|
||||
</StyledTableRows>
|
||||
</StyledTable>
|
||||
<AnimatedExpandableContainer
|
||||
isExpanded={!settingsDraftRole.canUpdateAllSettings}
|
||||
dimension="height"
|
||||
animationDurations={{
|
||||
opacity: 0.2,
|
||||
size: 0.4,
|
||||
}}
|
||||
mode="scroll-height"
|
||||
containAnimation={false}
|
||||
>
|
||||
<StyledTable>
|
||||
<SettingsRolePermissionsSettingsTableHeader />
|
||||
<StyledTableRows>
|
||||
{settingsPermissionsConfig.map((permission) => (
|
||||
<SettingsRolePermissionsSettingsTableRow
|
||||
key={permission.key}
|
||||
roleId={roleId}
|
||||
permission={permission}
|
||||
isEditable={isEditable}
|
||||
/>
|
||||
))}
|
||||
</StyledTableRows>
|
||||
</StyledTable>
|
||||
</AnimatedExpandableContainer>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user