From 52c7d84904f4781f132161728d0204889b1db729 Mon Sep 17 00:00:00 2001 From: Dinuka De Silva Date: Tue, 15 Jun 2021 16:07:48 -0400 Subject: [PATCH 01/12] Disabling the users page for normal users --- .../src/components/Breadcrumb.vue | 10 +++++++++- .../src/components/admin-portal/TenantUser.vue | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/custos-demo-gateway/src/components/Breadcrumb.vue b/custos-demo-gateway/src/components/Breadcrumb.vue index d5006990..f5031f82 100644 --- a/custos-demo-gateway/src/components/Breadcrumb.vue +++ b/custos-demo-gateway/src/components/Breadcrumb.vue @@ -2,7 +2,9 @@ - {{ link.name }} + + {{ link.name }} + @@ -23,4 +25,10 @@ export default { ol { margin: 0px; } + +a.disabled, a.disabled:hover { + text-decoration: line-through; + color: #6c757d; + cursor: initial; +} \ No newline at end of file diff --git a/custos-demo-gateway/src/components/admin-portal/TenantUser.vue b/custos-demo-gateway/src/components/admin-portal/TenantUser.vue index 8ad47509..0b731b52 100644 --- a/custos-demo-gateway/src/components/admin-portal/TenantUser.vue +++ b/custos-demo-gateway/src/components/admin-portal/TenantUser.vue @@ -249,12 +249,26 @@ export default { user() { return this.$store.getters["user/getUser"]({clientId: this.clientId, username: this.username}) }, + tenant() { + return this.$store.getters["tenant/getTenant"]({clientId: this.clientId}); + }, breadcrumbLinks() { - const _breadcrumbLinks = [{to: `/tenants/${this.clientId}/users`, name: "Users"}]; + const _breadcrumbLinks = []; + + if (this.tenant) { + _breadcrumbLinks.push({ + to: `/tenants/${this.clientId}/users`, + name: "Users", + disabled: !this.tenant.hasAdminPrivileges + }); + } + if (this.user) { + // alert("this.tenant.hasAdminPrivileges " + this.tenant.hasAdminPrivileges) _breadcrumbLinks.push({ to: `/tenants/${this.clientId}/users/${this.username}`, - name: this.title + name: this.title, + disabled: !this.tenant.hasAdminPrivileges }); } From e1041bd7b7ebe0815af6f7e9385be4ba09a345c5 Mon Sep 17 00:00:00 2001 From: Dinuka De Silva Date: Tue, 15 Jun 2021 16:08:16 -0400 Subject: [PATCH 02/12] Change input field validation regexes --- .../src/components/admin-portal/NewTenant.vue | 11 ++++++++--- .../src/components/admin-portal/TenantProfile.vue | 11 ++++++++--- .../src/components/admin-portal/TenantUser.vue | 12 ++++++++---- .../src/components/validation-regex.js | 4 +++- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/custos-demo-gateway/src/components/admin-portal/NewTenant.vue b/custos-demo-gateway/src/components/admin-portal/NewTenant.vue index d42adb46..3760530d 100644 --- a/custos-demo-gateway/src/components/admin-portal/NewTenant.vue +++ b/custos-demo-gateway/src/components/admin-portal/NewTenant.vue @@ -250,7 +250,12 @@ import store from "../../new-service/store"; import {custosService} from "@/new-service/store/util/custos.util"; import TenantHome from "@/components/admin-portal/TenantHome"; -import {VALIDATION_REGEX_DOMAIN, VALIDATION_REGEX_EMAIL, VALIDATION_REGEX_URI} from "@/components/validation-regex"; +import { + VALIDATION_REGEX_DOMAIN, + VALIDATION_REGEX_EMAIL, + VALIDATION_REGEX_FIRST_NAME, VALIDATION_REGEX_LAST_NAME, + VALIDATION_REGEX_URI +} from "@/components/validation-regex"; export default { components: {TenantHome}, @@ -328,8 +333,8 @@ export default { isValid() { return { username: !!this.username && this.username.length >= 3, - firstName: !!this.firstName && this.firstName.length > 0, - lastName: !!this.lastName && this.lastName.length > 0, + firstName: !!this.firstName && VALIDATION_REGEX_FIRST_NAME.test(this.firstName), + lastName: !!this.lastName && VALIDATION_REGEX_LAST_NAME.test(this.lastName), email: !!this.email && VALIDATION_REGEX_EMAIL.test(this.email), password: !!this.password && /[a-z]/.test(this.password) && // checks for a-z /[0-9]/.test(this.password) && // checks for 0-9 diff --git a/custos-demo-gateway/src/components/admin-portal/TenantProfile.vue b/custos-demo-gateway/src/components/admin-portal/TenantProfile.vue index 8b311f0f..629c2500 100644 --- a/custos-demo-gateway/src/components/admin-portal/TenantProfile.vue +++ b/custos-demo-gateway/src/components/admin-portal/TenantProfile.vue @@ -229,7 +229,12 @@ import store from "../../new-service/store"; import TenantHome from "@/components/admin-portal/TenantHome"; import {custosService} from "@/new-service/store/util/custos.util"; -import {VALIDATION_REGEX_DOMAIN, VALIDATION_REGEX_EMAIL, VALIDATION_REGEX_URI} from "@/components/validation-regex"; +import { + VALIDATION_REGEX_DOMAIN, + VALIDATION_REGEX_EMAIL, + VALIDATION_REGEX_FIRST_NAME, VALIDATION_REGEX_LAST_NAME, + VALIDATION_REGEX_URI +} from "@/components/validation-regex"; export default { name: "TenantProfile", @@ -299,8 +304,8 @@ export default { isValid() { return { username: !!this.username && this.username.length >= 3, - firstName: !!this.firstName && this.firstName.length > 0, - lastName: !!this.lastName && this.lastName.length > 0, + firstName: !!this.firstName && VALIDATION_REGEX_FIRST_NAME.test(this.firstName), + lastName: !!this.lastName && VALIDATION_REGEX_LAST_NAME.test(this.lastName), email: !!this.email && VALIDATION_REGEX_EMAIL.test(this.email), tenantName: !!this.tenantName && this.tenantName.length > 0, diff --git a/custos-demo-gateway/src/components/admin-portal/TenantUser.vue b/custos-demo-gateway/src/components/admin-portal/TenantUser.vue index 0b731b52..d8b11f5e 100644 --- a/custos-demo-gateway/src/components/admin-portal/TenantUser.vue +++ b/custos-demo-gateway/src/components/admin-portal/TenantUser.vue @@ -1,5 +1,5 @@