Add SuperAdmin role support to user management

Introduces the SUPER_ADMIN role in enums, updates admin check logic to include SuperAdmin, and adds SuperAdmin to the role options in the setup user component.
mazdak/UX-2303
Naeem Ullah 1 week ago
parent 356a159df5
commit 1ddb35bbac

@ -81,7 +81,7 @@ export class AuthenticationService {
isAdminUser(){ isAdminUser(){
if (this.storageService && this.storageService.getItem('user') != null) { if (this.storageService && this.storageService.getItem('user') != null) {
let cachedUser = JSON.parse(this.storageService.getItem('user') || '{}'); let cachedUser = JSON.parse(this.storageService.getItem('user') || '{}');
return cachedUser.user.role === HiddenValues.ADMIN_USER; return cachedUser.user.role === HiddenValues.ADMIN_USER || cachedUser.user.role === HiddenValues.SUPER_ADMIN;
} }
return false; return false;
} }

@ -44,6 +44,7 @@ export class SetupUserComponent implements OnInit {
isLoading: boolean = false; isLoading: boolean = false;
setupUserList: SetupUser[] = []; setupUserList: SetupUser[] = [];
roleOptions = [ roleOptions = [
{ label: 'SuperAdmin', value: 'SUPERADMIN' },
{ label: 'Admin', value: 'ADMIN' }, { label: 'Admin', value: 'ADMIN' },
{ label: 'User', value: 'USER' } { label: 'User', value: 'USER' }
]; ];

@ -41,6 +41,7 @@ export enum HiddenValues {
ORGANIZATION_USER = "O", ORGANIZATION_USER = "O",
VAC_USER = "V", VAC_USER = "V",
ADMIN_USER = "ADMIN", ADMIN_USER = "ADMIN",
SUPER_ADMIN = "SUPERADMIN",
DEFAULT_PASSWORD = "12345678", DEFAULT_PASSWORD = "12345678",
REVOLVING_FUND_PRODUCT = "101", REVOLVING_FUND_PRODUCT = "101",
INTERNAL_LENDING_PRODUCT = "102", INTERNAL_LENDING_PRODUCT = "102",

Loading…
Cancel
Save