Skip to content

Commit

Permalink
Update endpoint paths for user management
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Sep 7, 2023
1 parent 6322fea commit bae7bcd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
22 changes: 11 additions & 11 deletions src/app/services/group.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`, {});
}
}
6 changes: 3 additions & 3 deletions src/app/services/login.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
20 changes: 10 additions & 10 deletions src/app/services/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}

0 comments on commit bae7bcd

Please sign in to comment.