Skip to content

Commit 7a84224

Browse files
committed
method to check whether group has multiple (all) permissions
1 parent 78b582c commit 7a84224

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/auth/PermissionGroup.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ export class PermissionGroup implements Permissible, Iterable<Permission> {
2828
return false;
2929
}
3030

31+
/**
32+
* Check that the group has all the specified permissions.
33+
* @param permissions The permissions to check.
34+
*/
35+
public hasAll(permissions: Iterable<Permission>): boolean {
36+
for (const permission of permissions)
37+
if (!this.has(permission))
38+
return false;
39+
return true;
40+
}
41+
3142
/**
3243
* An iterator over the permissions in this group.
3344
*/

0 commit comments

Comments
 (0)