diff --git a/CCUI.DAPPI/src/app/services/auth/users-and-permissions-plugin.service.ts b/CCUI.DAPPI/src/app/services/auth/users-and-permissions-plugin.service.ts new file mode 100644 index 0000000..03e1398 --- /dev/null +++ b/CCUI.DAPPI/src/app/services/auth/users-and-permissions-plugin.service.ts @@ -0,0 +1,39 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { BASE_API_URL } from '../../../Constants'; + +export interface UsersAndPermissionsRoleItem { + Id: string; + Name: string; + IsDefaultForAuthenticatedUser: boolean; +} + +export interface UsersAndPermissionsPermissionItem { + PermissionName: string; + Description: string; + Selected: boolean; +} + +export type UsersAndPermissionsRolePermissionsResponse = Record< + string, + UsersAndPermissionsPermissionItem[] +>; + +@Injectable({ providedIn: 'root' }) +export class UsersAndPermissionsPluginService { + constructor(private http: HttpClient) {} + + getAllRoles(): Observable { + return this.http.get(`${BASE_API_URL}usersandpermissions/roles`); + } + + getRolePermissions(roleName: string): Observable { + const params = new HttpParams().set('roleName', roleName); + + return this.http.get( + `${BASE_API_URL}usersandpermissions`, + { params } + ); + } +} diff --git a/CCUI.DAPPI/src/app/settings/settings.component.html b/CCUI.DAPPI/src/app/settings/settings.component.html index 58d92dd..a2db8da 100644 --- a/CCUI.DAPPI/src/app/settings/settings.component.html +++ b/CCUI.DAPPI/src/app/settings/settings.component.html @@ -17,6 +17,22 @@
+
Plugins
+ + @if (usersAndPermissionsEnabled) { + + } + +
+
User Administration