]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix inherited permissions being set at user level & unable to unselect existing perms
authorshamoon <4887959+shamoon@users.noreply.github.com>
Mon, 20 Feb 2023 09:27:44 +0000 (01:27 -0800)
committershamoon <4887959+shamoon@users.noreply.github.com>
Mon, 20 Feb 2023 09:27:44 +0000 (01:27 -0800)
src-ui/src/app/components/common/permissions-select/permissions-select.component.ts

index 74e8a73c4f6d7406e9a5b59268823e1648865ce8..fa97a3b55884683689d4c9b5402719e531f7f2d8 100644 (file)
@@ -69,6 +69,10 @@ export class PermissionsSelectComponent
   }
 
   writeValue(permissions: string[]): void {
+    if (this.permissions === permissions) {
+      return
+    }
+
     this.permissions = permissions ?? []
     const allPerms = this._inheritedPermissions.concat(this.permissions)
 
@@ -138,7 +142,10 @@ export class PermissionsSelectComponent
           this.typesWithAllActions.delete(typeKey)
         }
       })
-      this.onChange(permissions)
+
+      this.onChange(
+        permissions.filter((p) => !this._inheritedPermissions.includes(p))
+      )
     })
   }