@shisyamo4131/air-guard-v2-schemas 2.2.3-dev.3 → 2.2.3-dev.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisyamo4131/air-guard-v2-schemas",
3
- "version": "2.2.3-dev.3",
3
+ "version": "2.2.3-dev.5",
4
4
  "description": "Schemas for AirGuard V2",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/User.js CHANGED
@@ -3,6 +3,7 @@
3
3
  * @version 1.1.0
4
4
  * @author shisyamo4131
5
5
  * @update 2025-11-24 Added `companyId`, `isAdmin`, `isTemporary` property.
6
+ * Changed to prevent deletion of admin users.
6
7
  *
7
8
  * @prop {string} email - User's email address.
8
9
  * @prop {string} displayName - User's display name.
@@ -10,6 +11,7 @@
10
11
  * @prop {Array<string>} roles - User roles/permissions.
11
12
  * @prop {boolean} disabled - Indicates if the user is disabled.
12
13
  * @prop {string} companyId - ID of the associated company.
14
+ * @prop {boolean} isAdmin - Indicates if the user is an administrator.
13
15
  * @prop {boolean} isTemporary - Indicates if the user is temporary.
14
16
  */
15
17
  import FireModel from "@shisyamo4131/air-firebase-v2";
@@ -42,9 +44,11 @@ export default class User extends FireModel {
42
44
  static collectionPath = "Users";
43
45
  static classProps = classProps;
44
46
 
45
- static headers = [
46
- { title: "email", key: "email" },
47
- { title: "表示名", key: "displayName" },
48
- { title: "管理者", key: "roles" },
49
- ];
47
+ async delete(updateOptions = {}) {
48
+ // Prevent deletion of administrator accounts
49
+ if (this.isAdmin) {
50
+ throw new Error("Administrator accounts cannot be deleted.");
51
+ }
52
+ await super.delete(updateOptions);
53
+ }
50
54
  }
@@ -45,12 +45,12 @@ const accessorImplementations = {
45
45
  prefecture: {
46
46
  enumerable: true,
47
47
  get() {
48
- if (!this.hasOwnProperty("prefCode")) {
49
- console.warn(
50
- "[アクセサ: prefecture] このオブジェクトに prefCode が定義されていません。"
51
- );
52
- return "";
53
- }
48
+ // if (!this.hasOwnProperty("prefCode")) {
49
+ // console.warn(
50
+ // "[アクセサ: prefecture] このオブジェクトに prefCode が定義されていません。"
51
+ // );
52
+ // return "";
53
+ // }
54
54
 
55
55
  if (!this.prefCode) return ""; // No warning if prefCode is falsy but present
56
56