@firecms/user_management 3.0.0-canary.120 → 3.0.0-canary.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -181,17 +181,19 @@ export function UserDetailsForm({
|
|
181
181
|
</div>
|
182
182
|
<div className={"col-span-12"}>
|
183
183
|
<MultiSelect
|
184
|
+
className={"w-full"}
|
184
185
|
label="Roles"
|
185
186
|
value={values.roles?.map(r => r.id) ?? []}
|
186
|
-
|
187
|
-
renderValue={(value: string) => {
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
}}
|
187
|
+
onValueChange={(value: string[]) => setFieldValue("roles", value.map(id => roles.find(r => r.id === id) as Role))}
|
188
|
+
// renderValue={(value: string) => {
|
189
|
+
// const userRole = roles
|
190
|
+
// .find((role) => role.id === value);
|
191
|
+
// if (!userRole) return null;
|
192
|
+
// return <div className="flex flex-wrap space-x-2 space-y-2">
|
193
|
+
// <RoleChip key={userRole?.id} role={userRole}/>
|
194
|
+
// </div>;
|
195
|
+
// }}
|
196
|
+
>
|
195
197
|
{roles.map(userRole => <MultiSelectItem key={userRole.id}
|
196
198
|
value={userRole.id}>
|
197
199
|
<RoleChip key={userRole?.id} role={userRole}/>
|
package/src/utils/permissions.ts
CHANGED
@@ -45,10 +45,10 @@ export function resolveUserRolePermissions<UserType extends User>
|
|
45
45
|
function resolveCollectionRole(role: Role, id: string): Permissions {
|
46
46
|
|
47
47
|
const basePermissions = {
|
48
|
-
read: role.isAdmin || role.defaultPermissions?.read,
|
49
|
-
create: role.isAdmin || role.defaultPermissions?.create,
|
50
|
-
edit: role.isAdmin || role.defaultPermissions?.edit,
|
51
|
-
delete: role.isAdmin || role.defaultPermissions?.delete
|
48
|
+
read: (role.isAdmin || role.defaultPermissions?.read) ?? false,
|
49
|
+
create: (role.isAdmin || role.defaultPermissions?.create) ?? false,
|
50
|
+
edit: (role.isAdmin || role.defaultPermissions?.edit) ?? false,
|
51
|
+
delete: (role.isAdmin || role.defaultPermissions?.delete) ?? false
|
52
52
|
};
|
53
53
|
const thisCollectionPermissions = role.collectionPermissions?.[id];
|
54
54
|
if (thisCollectionPermissions) {
|