From 8f1c919c555cb66461313b746a27ee893ea6230b Mon Sep 17 00:00:00 2001 From: Don Walizer <12420708+dwalizer@users.noreply.github.com> Date: Tue, 21 Nov 2023 09:34:02 -0500 Subject: [PATCH] #2474 Adjust filtering for user tables, add fields to revocation table --- .../components/access/RevokeUserAccess.vue | 22 ++++++++++++++----- dashboard/src/components/users/UsersTable.vue | 16 +++++++------- .../skills/storage/repos/UserRoleRepo.groovy | 10 +++++++-- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/dashboard/src/components/access/RevokeUserAccess.vue b/dashboard/src/components/access/RevokeUserAccess.vue index 84177d0e97..b40f572f9f 100644 --- a/dashboard/src/components/access/RevokeUserAccess.vue +++ b/dashboard/src/components/access/RevokeUserAccess.vue @@ -18,8 +18,8 @@ limitations under the License.
- - + +
@@ -70,7 +70,7 @@ limitations under the License. data() { return { filters: { - userId: '', + user: '', }, table: { items: [], @@ -87,6 +87,16 @@ limitations under the License. label: 'User Id', sortable: true, }, + { + key: 'firstName', + label: 'First Name', + sortable: true, + }, + { + key: 'lastName', + label: 'Last Name', + sortable: true, + }, ], pagination: { hideUnnecessary: true, @@ -123,11 +133,11 @@ limitations under the License. applyFilters() { this.table.options.pagination.currentPage = 1; this.loadData().then(() => { - this.$nextTick(() => this.$announcer.polite(`Revoke user access table has been filtered by ${this.filters.userId}`)); + this.$nextTick(() => this.$announcer.polite(`Revoke user access table has been filtered by ${this.filters.user}`)); }); }, reset() { - this.filters.userId = ''; + this.filters.user = ''; this.table.options.pagination.currentPage = 1; this.loadData().then(() => { this.$nextTick(() => this.$announcer.polite('Revoke user access table filters have been removed')); @@ -136,7 +146,7 @@ limitations under the License. loadData() { this.table.options.busy = true; const pageParams = { - query: this.filters.userId, + query: this.filters.user, limit: this.table.options.pagination.pageSize, ascending: !this.table.options.sortDesc, page: this.table.options.pagination.currentPage, diff --git a/dashboard/src/components/users/UsersTable.vue b/dashboard/src/components/users/UsersTable.vue index 4aa0a75499..5d3b765eae 100644 --- a/dashboard/src/components/users/UsersTable.vue +++ b/dashboard/src/components/users/UsersTable.vue @@ -17,8 +17,8 @@ limitations under the License.
- - + +
@@ -138,7 +138,7 @@ limitations under the License. inviteOnlyProject: false, data: [], filters: { - userId: '', + user: '', progress: 0, minimumPoints: 0, }, @@ -246,17 +246,17 @@ limitations under the License. this.filters.minimumPoints = Math.floor(this.totalPoints * (this.filters.progress / 100)); this.loadData().then(() => { let filterMessage = 'Users table has been filtered by'; - if (this.filters.userId) { - filterMessage += ` ${this.filters.userId}`; + if (this.filters.user) { + filterMessage += ` ${this.filters.user}`; } if (this.filters.minimumPoints > 0) { - filterMessage += `${this.filters.userId ? ' and' : ''} users with at least ${this.filters.minimumPoints} points`; + filterMessage += `${this.filters.user ? ' and' : ''} users with at least ${this.filters.minimumPoints} points`; } this.$nextTick(() => this.$announcer.polite(filterMessage)); }); }, reset() { - this.filters.userId = ''; + this.filters.user = ''; this.filters.minimumPoints = 0; this.filters.progress = 0; this.table.options.pagination.currentPage = 1; @@ -268,7 +268,7 @@ limitations under the License. this.table.options.busy = true; const url = this.getUrl(); return UsersService.ajaxCall(url, { - query: this.filters.userId, + query: this.filters.user, limit: this.table.options.pagination.pageSize, ascending: !this.table.options.sortDesc, page: this.table.options.pagination.currentPage, diff --git a/service/src/main/java/skills/storage/repos/UserRoleRepo.groovy b/service/src/main/java/skills/storage/repos/UserRoleRepo.groovy index c200a525ab..62509c492e 100644 --- a/service/src/main/java/skills/storage/repos/UserRoleRepo.groovy +++ b/service/src/main/java/skills/storage/repos/UserRoleRepo.groovy @@ -67,7 +67,10 @@ interface UserRoleRepo extends CrudRepository { ur.userId = ua.userId and ur.projectId = ?1 and ur.roleName = ?2 and - ur.userId like lower(CONCAT('%', ?3, '%'))''') + (ur.userId like lower(CONCAT('%', ?3, '%')) or + lower(ua.firstName) like lower(CONCAT('%', ?3, '%')) or + lower(ua.lastName) like lower(CONCAT('%', ?3, '%'))) + ''') List findRoleWithAttrsByProjectIdAndRoleNameAndUserIdLike(String projectId, RoleName roleName, String userIdQuery, PageRequest pageRequest) @Query('''SELECT count(ur.id) from UserRole ur, UserAttrs ua @@ -75,7 +78,10 @@ interface UserRoleRepo extends CrudRepository { ur.userId = ua.userId and ur.projectId = ?1 and ur.roleName = ?2 and - ur.userId like lower(CONCAT('%', ?3, '%'))''') + (ur.userId like lower(CONCAT('%', ?3, '%')) or + lower(ua.firstName) like lower(CONCAT('%', ?3, '%')) or + lower(ua.lastName) like lower(CONCAT('%', ?3, '%'))) + ''') Integer countRoleWithAttrsByProjectIdAndRoleNameAndUserIdLike(String projectId, RoleName roleName, String userIdQuery) @Query('''SELECT ur as role, ua as attrs