ocket8888 commented on code in PR #7514:
URL: https://github.com/apache/trafficcontrol/pull/7514#discussion_r1204782168
##########
experimental/traffic-portal/src/app/api/user.service.ts:
##########
@@ -267,6 +268,38 @@ 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 along with lastUpdated field.
+ */
+ public async createRole(role: RequestRole): Promise<ResponseRole> {
+ return this.post<ResponseRole>("roles", role).toPromise();
+ }
+
+ /**
+ * Updates an existing Role.
+ *
+ * @param name The original role name
+ * @param role The role to update.
+ * @returns The updated role without lastUpdated field.
+ */
+ public async updateRole(name: string, role: ResponseRole):
Promise<ResponseRole> {
+ return this.put<ResponseRole>("roles?", role,
{name}).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 name = typeof(role) === "string" ? role : role.name;
Review Comment:
Because passing a role object rather than just a name isn't being tested,
coverage in this file hits 100% of functions, 100% of lines, but only 96.15% of
branches - down from 100% on the master branch. The only thing missing is that
`role.name` branch.
--
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]