Skip to content

Commit

Permalink
fix: Ensure at least one permission when calling for on secure resour…
Browse files Browse the repository at this point in the history
…ces. (#209)
  • Loading branch information
davemooreuws committed Nov 13, 2023
2 parents 4d87da8 + b68b855 commit 94707b6
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/resources/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class BucketResource extends SecureResource<BucketPermission> {
* @param perms the required permission set
* @returns a usable bucket reference
*/
public for(...perms: BucketPermission[]): Bucket {
public for(perm: BucketPermission, ...perms: BucketPermission[]): Bucket {
this.registerPolicy(...perms);

return storage().bucket(this.name);
Expand Down
2 changes: 1 addition & 1 deletion src/resources/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class CollectionResource<
* @param perms the required permission set
* @returns a usable collection reference
*/
public for(...perms: CollectionPermission[]) {
public for(perm: CollectionPermission, ...perms: CollectionPermission[]) {
this.registerPolicy(...perms);

return documents().collection<T>(this.name);
Expand Down
2 changes: 1 addition & 1 deletion src/resources/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class QueueResource<
* @param perms the access that the currently scoped function is requesting to this resource.
* @returns a useable queue.
*/
public for(...perms: QueuePermission[]): Queue<T> {
public for(perm: QueuePermission, ...perms: QueuePermission[]): Queue<T> {
this.registerPolicy(...perms);

return queues().queue(this.name);
Expand Down
2 changes: 1 addition & 1 deletion src/resources/secret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class SecretResource extends SecureResource<SecretPermission> {
throw new Error('details unimplemented for secret');
}

public for(...perms: SecretPermission[]): Secret {
public for(perm: SecretPermission, ...perms: SecretPermission[]): Secret {
this.registerPolicy(...perms);

return secrets().secret(this.name);
Expand Down
2 changes: 1 addition & 1 deletion src/resources/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export class TopicResource<
* @param perms the required permission set
* @returns a usable topic reference
*/
public for(...perms: TopicPermission[]): Topic<T> {
public for(perm: TopicPermission, ...perms: TopicPermission[]): Topic<T> {
this.registerPolicy(...perms);
return events().topic(this.name);
}
Expand Down

0 comments on commit 94707b6

Please sign in to comment.