@edgedev/firebase 1.4.6 → 1.4.7

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.
package/README.md CHANGED
@@ -170,6 +170,15 @@ edgeFirebase.storeCollectionPermissions(
170
170
  );
171
171
  ```
172
172
 
173
+ Deleting collection permissions. This is done to "clean up" whenever a collection path is being deleted.
174
+
175
+ ```javascript
176
+ edgeFirebase.removeCollectionPermissions(
177
+ "myItems/subitems/things")
178
+ ```
179
+
180
+
181
+
173
182
  ### User roles for collections
174
183
 
175
184
  Users are assigned roles based on collection paths. A role assigned by a collection path that has sub collections will also determine what the user can do on all sub collections or a user can be assigned a role specifically for a sub collection only. For example if a user is assigned as admin for "myItems/subitems/things" they will only have admin acces to that collection. But if the user is assigned as an admin for "myItems" they will have the admin permissions for "myItems" and all sub collections of "myItems".
package/edgeFirebase.ts CHANGED
@@ -1238,6 +1238,24 @@ export const EdgeFirebase = class {
1238
1238
  }
1239
1239
  };
1240
1240
 
1241
+ public removeCollectionPermissions = async (
1242
+ collectionPath: string,
1243
+ ): Promise<actionResponse> => {
1244
+ const canAssign = await this.permissionCheck("assign", collectionPath);
1245
+ if (canAssign) {
1246
+ await deleteDoc(doc(this.db, "collection-data", collectionPath.replaceAll("/", "-")));
1247
+ return this.sendResponse({
1248
+ success: true,
1249
+ message: ""
1250
+ });
1251
+ } else {
1252
+ return this.sendResponse({
1253
+ success: false,
1254
+ message: "Cannot remove permissions for collection path: " + collectionPath
1255
+ });
1256
+ }
1257
+ };
1258
+
1241
1259
  public storeCollectionPermissions = async (
1242
1260
  collectionPath: string,
1243
1261
  role: "admin" | "user",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgedev/firebase",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "Vue 3 / Nuxt 3 Plugin or Nuxt 3 global composable for firebase authentication and firestore.",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -30,6 +30,7 @@
30
30
  "firebase": "^9.12.1",
31
31
  "prettier": "^2.7.1",
32
32
  "typescript": "^4.8.4",
33
+ "vite": "^4.0.4",
33
34
  "vue": "^3.2.41"
34
35
  },
35
36
  "peerDependencies": {