ocket8888 commented on code in PR #7514:
URL: https://github.com/apache/trafficcontrol/pull/7514#discussion_r1194208771
##########
experimental/traffic-portal/src/app/api/user.service.ts:
##########
@@ -267,6 +268,37 @@ export class UserService extends APIService {
return this.get<Array<ResponseRole>>(path).toPromise();
}
+ /**
+ * Creates a new Role.
+ *
+ * @param role The role to create.
+ * @returns The created role.
+ */
+ public async createRole(role: RequestRole): Promise<ResponseRole> {
+ return this.post<ResponseRole>("roles", role).toPromise();
+ }
+
+ /**
+ * Updates an existing Role.
+ *
+ * @param role The role to update.
+ * @returns The updated role.
+ */
+ public async updateRole(role: ResponseRole): Promise<ResponseRole> {
+ return this.put<ResponseRole>(`roles?name=${role.name}`,
role).toPromise();
+ }
+
+ /**
+ * Deletes an existing role.
+ *
+ * @param role The role to be deleted.
+ * @returns The deleted role.
+ */
+ public async deleteRole(role: string | ResponseRole): Promise<void> {
+ const roleName = typeof(role) === "string" ? role : role.name;
+ return this.delete(`roles?name=${roleName}`).toPromise();
+ }
Review Comment:
You can see a report of the coverage using the `--code-coverage` flag for
`ng test`. So, to put that all together: `ng test --code-coverage`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]