Update endpoint paths for user management

This commit is contained in:
grossmj 2023-09-07 14:46:23 +07:00
parent 6322fea306
commit bae7bcdd8d
3 changed files with 24 additions and 24 deletions

View File

@ -29,46 +29,46 @@ export class GroupService {
}
getGroups(controller: Controller) {
return this.httpController.get<Group[]>(controller, '/groups');
return this.httpController.get<Group[]>(controller, '/access/groups');
}
getGroupMember(controller: Controller, groupId: string) {
return this.httpController.get<User[]>(controller, `/groups/${groupId}/members`);
return this.httpController.get<User[]>(controller, `/access/groups/${groupId}/members`);
}
addGroup(controller: Controller, name: string): Observable<Group> {
return this.httpController.post<Group>(controller, `/groups`, {name});
return this.httpController.post<Group>(controller, `/access/groups`, {name});
}
delete(controller: Controller, user_group_id: string) {
return this.httpController.delete(controller, `/groups/${user_group_id}`);
return this.httpController.delete(controller, `/access/groups/${user_group_id}`);
}
get(controller: Controller, user_group_id: string) {
return this.httpController.get(controller, `/groups/${user_group_id}`);
return this.httpController.get(controller, `/access/groups/${user_group_id}`);
}
addMemberToGroup(controller: Controller, group: Group, user: User) {
return this.httpController.put(controller, `/groups/${group.user_group_id}/members/${user.user_id}`, {});
return this.httpController.put(controller, `/access/groups/${group.user_group_id}/members/${user.user_id}`, {});
}
removeUser(controller: Controller, group: Group, user: User) {
return this.httpController.delete(controller, `/groups/${group.user_group_id}/members/${user.user_id}`);
return this.httpController.delete(controller, `/access/groups/${group.user_group_id}/members/${user.user_id}`);
}
update(controller: Controller, group: Group) {
return this.httpController.put(controller, `/groups/${group.user_group_id}`, {name: group.name});
return this.httpController.put(controller, `/access/groups/${group.user_group_id}`, {name: group.name});
}
getGroupRole(controller: Controller, groupId: string) {
return this.httpController.get<Role[]>(controller, `/groups/${groupId}/roles`);
return this.httpController.get<Role[]>(controller, `/access/groups/${groupId}/roles`);
}
removeRole(controller: Controller, group: Group, role: Role) {
return this.httpController.delete(controller, `/groups/${group.user_group_id}/roles/${role.role_id}`);
return this.httpController.delete(controller, `/access/groups/${group.user_group_id}/roles/${role.role_id}`);
}
addRoleToGroup(controller: Controller, group: Group, role: Role) {
return this.httpController.put(controller, `/groups/${group.user_group_id}/roles/${role.role_id}`, {});
return this.httpController.put(controller, `/access/groups/${group.user_group_id}/roles/${role.role_id}`, {});
}
}

View File

@ -19,13 +19,13 @@ export class LoginService {
headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
};
return this.httpController.post<AuthResponse>(controller, '/users/login', payload, options);
return this.httpController.post<AuthResponse>(controller, '/access/users/login', payload, options);
}
getLoggedUser(controller:Controller ) {
return this.httpController.get(controller, "/users/me").toPromise()
return this.httpController.get(controller, "/access/users/me").toPromise()
}
async getLoggedUserRefToken(controller:Controller ,current_user):Promise<any> {
return await this.httpController.post<AuthResponse>(controller, "/users/authenticate", {"username":current_user.username,"password":current_user.password}).toPromise()
return await this.httpController.post<AuthResponse>(controller, "/access/users/authenticate", {"username":current_user.username,"password":current_user.password}).toPromise()
}
}

View File

@ -14,42 +14,42 @@ export class UserService {
) {}
getInformationAboutLoggedUser(controller: Controller) {
return this.httpController.get<User>(controller, '/users/me/');
return this.httpController.get<User>(controller, '/access/users/me/');
}
get(controller: Controller, user_id: string) {
return this.httpController.get<User>(controller, `/users/${user_id}`);
return this.httpController.get<User>(controller, `/access/users/${user_id}`);
}
list(controller: Controller) {
return this.httpController.get<User[]>(controller, '/users');
return this.httpController.get<User[]>(controller, '/access/users');
}
add(controller: Controller, user: any): Observable<User> {
return this.httpController.post<User>(controller, `/users`, user);
return this.httpController.post<User>(controller, `/access/users`, user);
}
delete(controller: Controller, user_id: string) {
return this.httpController.delete(controller, `/users/${user_id}`);
return this.httpController.delete(controller, `/access/users/${user_id}`);
}
update(controller: Controller, user: any): Observable<User> {
return this.httpController.put<User>(controller, `/users/${user.user_id}`, user);
return this.httpController.put<User>(controller, `/access/users/${user.user_id}`, user);
}
getGroupsByUserId(controller: Controller, user_id: string) {
return this.httpController.get<Group[]>(controller, `/users/${user_id}/groups`);
return this.httpController.get<Group[]>(controller, `/access/users/${user_id}/groups`);
}
getPermissionsByUserId(controller: Controller, user_id: string) {
return this.httpController.get<Permission[]>(controller, `/users/${user_id}/permissions`);
return this.httpController.get<Permission[]>(controller, `/access/users/${user_id}/permissions`);
}
addPermission(controller: Controller, user_id: string, permission: Permission) {
return this.httpController.put(controller, `/users/${user_id}/permissions/${permission.permission_id}`, {});
return this.httpController.put(controller, `/access/users/${user_id}/permissions/${permission.permission_id}`, {});
}
removePermission(controller: Controller, user_id: string, permission: Permission) {
return this.httpController.delete(controller, `/users/${user_id}/permissions/${permission.permission_id}`);
return this.httpController.delete(controller, `/access/users/${user_id}/permissions/${permission.permission_id}`);
}
}