@tmlmobilidade/utils 20250828.1816.30 → 20250828.2255.34
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.
|
@@ -8,11 +8,11 @@ import { type Permission } from '@tmlmobilidade/types';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function getPermission(permissions: Permission<unknown>[], scope: string, action: string): Permission<unknown>;
|
|
10
10
|
/**
|
|
11
|
-
* Check if a permission exists in a list of permissions
|
|
12
|
-
* @param permissions
|
|
13
|
-
* @param scope
|
|
14
|
-
* @param action
|
|
15
|
-
* @returns The permission
|
|
11
|
+
* Check if a permission exists in a list of permissions.
|
|
12
|
+
* @param permissions The list of permissions.
|
|
13
|
+
* @param scope The scope of the permission.
|
|
14
|
+
* @param action The action of the permission.
|
|
15
|
+
* @returns The permission object or undefined if not found.
|
|
16
16
|
*/
|
|
17
17
|
export declare function hasPermission(permissions: Permission<unknown>[], scope: string, action: string): boolean;
|
|
18
18
|
export interface HasPermissionResourceArgs<T> {
|
package/dist/src/permissions.js
CHANGED
|
@@ -20,11 +20,11 @@ export function getPermission(permissions, scope, action) {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Check if a permission exists in a list of permissions
|
|
24
|
-
* @param permissions
|
|
25
|
-
* @param scope
|
|
26
|
-
* @param action
|
|
27
|
-
* @returns The permission
|
|
23
|
+
* Check if a permission exists in a list of permissions.
|
|
24
|
+
* @param permissions The list of permissions.
|
|
25
|
+
* @param scope The scope of the permission.
|
|
26
|
+
* @param action The action of the permission.
|
|
27
|
+
* @returns The permission object or undefined if not found.
|
|
28
28
|
*/
|
|
29
29
|
export function hasPermission(permissions, scope, action) {
|
|
30
30
|
return permissions.find(permission => permission.scope === scope && permission.action === action) !== undefined;
|
package/package.json
CHANGED