From 8971eeef7bed505b664fb0769679104cf61b9606 Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Thu, 15 Jun 2023 11:36:03 -0500 Subject: [PATCH 1/3] Add getPossibleRoles to user-provider --- src/providers/user/user-provider.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/providers/user/user-provider.js b/src/providers/user/user-provider.js index be5be652..346b0ba0 100644 --- a/src/providers/user/user-provider.js +++ b/src/providers/user/user-provider.js @@ -78,6 +78,12 @@ export default class UserProvider extends EventEmitter { return statusRoles.includes(role); } + async getPossibleRoles() { + const statusRoles = await this.roleStatus.getAllStatusRoles(); + + return statusRoles; + } + async hasRole(roleName) { const user = await this.getCurrentUser(); From be9ca1398155143c496336dfff9a61d5a475d82b Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Fri, 23 Jun 2023 16:51:58 -0500 Subject: [PATCH 2/3] Updated with a note --- src/providers/user/user-provider.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/providers/user/user-provider.js b/src/providers/user/user-provider.js index 346b0ba0..bfe4159f 100644 --- a/src/providers/user/user-provider.js +++ b/src/providers/user/user-provider.js @@ -79,6 +79,7 @@ export default class UserProvider extends EventEmitter { } async getPossibleRoles() { + // returns only status capable roles const statusRoles = await this.roleStatus.getAllStatusRoles(); return statusRoles; From f170128da591e25fc4efa14515daf5950f85e32d Mon Sep 17 00:00:00 2001 From: Michael Rogers Date: Thu, 13 Jul 2023 11:40:38 -0500 Subject: [PATCH 3/3] Return user.roles instead of allStatusRoles --- src/providers/user/user-provider.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/providers/user/user-provider.js b/src/providers/user/user-provider.js index bfe4159f..a50ef4d5 100644 --- a/src/providers/user/user-provider.js +++ b/src/providers/user/user-provider.js @@ -79,10 +79,9 @@ export default class UserProvider extends EventEmitter { } async getPossibleRoles() { - // returns only status capable roles - const statusRoles = await this.roleStatus.getAllStatusRoles(); + const user = await this.getCurrentUser(); - return statusRoles; + return user.roles; } async hasRole(roleName) {