@fonoster/identity 0.15.11 → 0.15.13

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.
@@ -47,7 +47,8 @@ function createIsAdminMember(prisma) {
47
47
  if ((workspace === null || workspace === void 0 ? void 0 : workspace.ownerRef) === adminRef) {
48
48
  return true;
49
49
  }
50
- const role = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.members.find((member) => member.ref === adminRef)) === null || _a === void 0 ? void 0 : _a.role;
50
+ const role = (_a = workspace === null || workspace === void 0 ? void 0 : workspace.members.find((member) => member.userRef === adminRef &&
51
+ member.status === types_1.WorkspaceMemberStatus.ACTIVE)) === null || _a === void 0 ? void 0 : _a.role;
51
52
  return role === types_1.Role.WORKSPACE_ADMIN || role === types_1.Role.WORKSPACE_OWNER;
52
53
  });
53
54
  };
@@ -1,21 +1,3 @@
1
- /**
2
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
- * http://github.com/fonoster/fonoster
4
- *
5
- * This file is part of Fonoster
6
- *
7
- * Licensed under the MIT License (the "License");
8
- * you may not use this file except in compliance with
9
- * the License. You may obtain a copy of the License at
10
- *
11
- * https://opensource.org/licenses/MIT
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
1
  import { Prisma } from "../db";
20
2
  declare function createIsWorkspaceMember(prisma: Prisma): (workspaceRef: string, userRef: string) => Promise<boolean>;
21
3
  export { createIsWorkspaceMember };
@@ -10,6 +10,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.createIsWorkspaceMember = createIsWorkspaceMember;
13
+ /**
14
+ * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
15
+ * http://github.com/fonoster/fonoster
16
+ *
17
+ * This file is part of Fonoster
18
+ *
19
+ * Licensed under the MIT License (the "License");
20
+ * you may not use this file except in compliance with
21
+ * the License. You may obtain a copy of the License at
22
+ *
23
+ * https://opensource.org/licenses/MIT
24
+ *
25
+ * Unless required by applicable law or agreed to in writing, software
26
+ * distributed under the License is distributed on an "AS IS" BASIS,
27
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28
+ * See the License for the specific language governing permissions and
29
+ * limitations under the License.
30
+ */
31
+ const types_1 = require("@fonoster/types");
13
32
  function createIsWorkspaceMember(prisma) {
14
33
  return function isWorkspaceMember(workspaceRef, userRef) {
15
34
  return __awaiter(this, void 0, void 0, function* () {
@@ -23,7 +42,8 @@ function createIsWorkspaceMember(prisma) {
23
42
  // Force userId to be an empty string to ensure that the query is not
24
43
  // filter by workspaceRef only
25
44
  userRef: userRef || "",
26
- workspaceRef
45
+ workspaceRef,
46
+ status: types_1.WorkspaceMemberStatus.ACTIVE
27
47
  }
28
48
  });
29
49
  const isOwner = (workspace === null || workspace === void 0 ? void 0 : workspace.ownerRef) === userRef;
@@ -30,6 +30,7 @@ exports.createListWorkspaces = createListWorkspaces;
30
30
  */
31
31
  const common_1 = require("@fonoster/common");
32
32
  const logger_1 = require("@fonoster/logger");
33
+ const types_1 = require("@fonoster/types");
33
34
  const getUserRefFromToken_1 = require("../utils/getUserRefFromToken");
34
35
  const logger = (0, logger_1.getLogger)({ service: "identity", filePath: __filename });
35
36
  function createListWorkspaces(prisma) {
@@ -54,7 +55,8 @@ function createListWorkspaces(prisma) {
54
55
  {
55
56
  members: {
56
57
  some: {
57
- userRef
58
+ userRef,
59
+ status: types_1.WorkspaceMemberStatus.ACTIVE
58
60
  }
59
61
  }
60
62
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonoster/identity",
3
- "version": "0.15.11",
3
+ "version": "0.15.13",
4
4
  "description": "Identity service for Fonoster",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/fonoster#readme",
@@ -20,7 +20,7 @@
20
20
  "fonoster": "./dist/index.js"
21
21
  },
22
22
  "dependencies": {
23
- "@fonoster/common": "^0.15.10",
23
+ "@fonoster/common": "^0.15.13",
24
24
  "@fonoster/logger": "^0.15.10",
25
25
  "@fonoster/types": "^0.15.10",
26
26
  "@grpc/grpc-js": "~1.10.6",
@@ -48,5 +48,5 @@
48
48
  "devDependencies": {
49
49
  "@types/jsonwebtoken": "^9.0.6"
50
50
  },
51
- "gitHead": "4264558703c02eaf9384e7fab69b4752cd1efd87"
51
+ "gitHead": "67749f08fc091becead3ecb08f662cd0b129f572"
52
52
  }