@things-factory/auth-ui 8.0.0-alpha.35 → 8.0.0-alpha.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/components/abstract-password-reset.ts +4 -11
- package/client/components/invite-user.ts +4 -4
- package/client/components/ownership-transfer-popup.ts +3 -3
- package/client/components/role-privilege-editor.ts +31 -5
- package/client/components/user-role-editor.ts +18 -18
- package/client/pages/user/user-management.ts +7 -8
- package/dist-client/components/abstract-password-reset.d.ts +1 -2
- package/dist-client/components/abstract-password-reset.js +2 -11
- package/dist-client/components/abstract-password-reset.js.map +1 -1
- package/dist-client/components/invite-user.js +4 -4
- package/dist-client/components/invite-user.js.map +1 -1
- package/dist-client/components/ownership-transfer-popup.js +3 -3
- package/dist-client/components/ownership-transfer-popup.js.map +1 -1
- package/dist-client/components/role-privilege-editor.js +38 -9
- package/dist-client/components/role-privilege-editor.js.map +1 -1
- package/dist-client/components/user-role-editor.js +18 -18
- package/dist-client/components/user-role-editor.js.map +1 -1
- package/dist-client/pages/user/user-management.js +6 -7
- package/dist-client/pages/user/user-management.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/translations/en.json +0 -1
- package/translations/ja.json +0 -1
- package/translations/ko.json +0 -1
- package/translations/ms.json +0 -1
- package/translations/zh.json +0 -1
|
@@ -2,17 +2,16 @@ import '@material/web/icon/icon.js'
|
|
|
2
2
|
import '@material/web/button/elevated-button.js'
|
|
3
3
|
import '@material/web/textfield/filled-text-field.js'
|
|
4
4
|
|
|
5
|
-
import '@operato/lottie-player'
|
|
6
|
-
import '../components/profile-component'
|
|
7
5
|
import '@operato/i18n/ox-i18n.js'
|
|
8
6
|
import '@operato/i18n/ox-i18n-selector.js'
|
|
9
7
|
import '@operato/layout/ox-snack-bar.js'
|
|
10
8
|
|
|
9
|
+
import '../components/profile-component'
|
|
10
|
+
|
|
11
11
|
import { css, html, nothing } from 'lit'
|
|
12
12
|
import { property, query } from 'lit/decorators.js'
|
|
13
13
|
|
|
14
14
|
import { i18next } from '@operato/i18n'
|
|
15
|
-
import { isSafari } from '@operato/utils'
|
|
16
15
|
|
|
17
16
|
import { AUTH_STYLE_SIGN } from '../auth-style-sign'
|
|
18
17
|
import { generatePasswordPatternHelp, generatePasswordPatternRegExp } from '../utils/password-rule'
|
|
@@ -130,20 +129,14 @@ export abstract class AbstractPasswordReset extends AbstractAuthPage {
|
|
|
130
129
|
</form>
|
|
131
130
|
</div>
|
|
132
131
|
</div>
|
|
133
|
-
<ox-snack-bar id="snackbar" level="error" .message=${this.message}></ox-snack-bar>
|
|
134
132
|
|
|
135
|
-
|
|
136
|
-
? html``
|
|
137
|
-
: html`
|
|
138
|
-
<div class="lottie-container">
|
|
139
|
-
<lottie-player autoplay loop src="../../assets/images/background-animation.json"></lottie-player>
|
|
140
|
-
</div>
|
|
141
|
-
`}
|
|
133
|
+
<ox-snack-bar id="snackbar" level="error" .message=${this.message}></ox-snack-bar>
|
|
142
134
|
`
|
|
143
135
|
}
|
|
144
136
|
|
|
145
137
|
updated(changed) {
|
|
146
138
|
super.updated(changed)
|
|
139
|
+
|
|
147
140
|
if (changed.has('data')) {
|
|
148
141
|
this.token = this.data.token
|
|
149
142
|
}
|
|
@@ -81,14 +81,14 @@ class InviteUser extends localize(i18next)(LitElement) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
async inviteUser(
|
|
84
|
+
async inviteUser(username) {
|
|
85
85
|
const response = await client.mutate({
|
|
86
86
|
mutation: gql`
|
|
87
|
-
mutation inviteUser($
|
|
88
|
-
inviteUser(
|
|
87
|
+
mutation inviteUser($username: String!) {
|
|
88
|
+
inviteUser(username: $username)
|
|
89
89
|
}
|
|
90
90
|
`,
|
|
91
|
-
variables: {
|
|
91
|
+
variables: { username },
|
|
92
92
|
context: gqlContext()
|
|
93
93
|
})
|
|
94
94
|
|
|
@@ -75,11 +75,11 @@ class OwnershipTransferPopup extends localize(i18next)(LitElement) {
|
|
|
75
75
|
) {
|
|
76
76
|
const response = await client.mutate({
|
|
77
77
|
mutation: gql`
|
|
78
|
-
mutation transferOwner($
|
|
79
|
-
transferOwner(
|
|
78
|
+
mutation transferOwner($username: String!) {
|
|
79
|
+
transferOwner(username: $username)
|
|
80
80
|
}
|
|
81
81
|
`,
|
|
82
|
-
variables: {
|
|
82
|
+
variables: { username: this.user.username || this.user.email },
|
|
83
83
|
context: gqlContext()
|
|
84
84
|
})
|
|
85
85
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import gql from 'graphql-tag'
|
|
2
2
|
import { css, html, LitElement } from 'lit'
|
|
3
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
4
4
|
|
|
5
5
|
import { client, gqlContext } from '@operato/graphql'
|
|
6
6
|
import { i18next, localize } from '@operato/i18n'
|
|
@@ -24,6 +24,17 @@ class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
|
24
24
|
margin: var(--spacing-medium);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
div[users] {
|
|
28
|
+
margin: 0;
|
|
29
|
+
background-color: var(--md-sys-color-surface-variant);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
div[titler] {
|
|
33
|
+
color: var(--md-sys-color-secondary);
|
|
34
|
+
font: bold 1.2em var(--theme-font);
|
|
35
|
+
text-transform: capitalize;
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
ul {
|
|
28
39
|
flex: 1;
|
|
29
40
|
color: var(--md-sys-color-secondary);
|
|
@@ -31,7 +42,8 @@ class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
|
31
42
|
overflow: auto;
|
|
32
43
|
display: grid;
|
|
33
44
|
grid-template-columns: 1fr 1fr;
|
|
34
|
-
margin: 0;
|
|
45
|
+
margin-block-start: 0;
|
|
46
|
+
margin-block-end: 0;
|
|
35
47
|
padding: var(--spacing-medium);
|
|
36
48
|
list-style: none;
|
|
37
49
|
border: 1px dashed rgba(0, 0, 0, 0.1);
|
|
@@ -72,14 +84,23 @@ class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
|
72
84
|
|
|
73
85
|
@property({ type: Object }) role: any
|
|
74
86
|
@property({ type: Array }) allPrivileges: any[] = []
|
|
75
|
-
@property({ type: Array }) privileges: any[] = []
|
|
76
87
|
@property({ type: Object }) updateRoleObj: any
|
|
77
88
|
|
|
89
|
+
@state() privileges: { id: string; description: string }[] = []
|
|
90
|
+
@state() users: { /* id: string; username: string; */ name: string; email: string }[] = []
|
|
91
|
+
|
|
78
92
|
render() {
|
|
79
93
|
const allPrivileges = this.allPrivileges || []
|
|
80
94
|
const privileges = this.privileges || []
|
|
95
|
+
const users = this.users || []
|
|
81
96
|
|
|
82
97
|
return html`
|
|
98
|
+
<div titler>${String(i18next.t('label.user'))}</div>
|
|
99
|
+
|
|
100
|
+
<div users>${users.map(user => html`<div>${user.name} (${user.email})</div>`)}</div>
|
|
101
|
+
|
|
102
|
+
<div titler>${String(i18next.t('field.privileges'))}</div>
|
|
103
|
+
|
|
83
104
|
<div>
|
|
84
105
|
<input id="checkAll" type="checkbox" @change=${e => this.oncheckAll(e)} />
|
|
85
106
|
<label for="checkAll">Check all</label>
|
|
@@ -116,7 +137,7 @@ class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
|
116
137
|
|
|
117
138
|
async updated(changes) {
|
|
118
139
|
if (changes.has('role')) {
|
|
119
|
-
|
|
140
|
+
await this.fetchPrivilegesOnRole(this.role.name)
|
|
120
141
|
}
|
|
121
142
|
}
|
|
122
143
|
|
|
@@ -226,6 +247,10 @@ class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
|
226
247
|
id
|
|
227
248
|
description
|
|
228
249
|
}
|
|
250
|
+
users {
|
|
251
|
+
name
|
|
252
|
+
email
|
|
253
|
+
}
|
|
229
254
|
}
|
|
230
255
|
}
|
|
231
256
|
`,
|
|
@@ -233,7 +258,8 @@ class RolePrivilegeEditor extends localize(i18next)(LitElement) {
|
|
|
233
258
|
context: gqlContext()
|
|
234
259
|
})
|
|
235
260
|
|
|
236
|
-
|
|
261
|
+
this.privileges = response.data.role?.privileges
|
|
262
|
+
this.users = response.data.role?.users
|
|
237
263
|
}
|
|
238
264
|
|
|
239
265
|
showToast(message) {
|
|
@@ -113,8 +113,8 @@ class UserRoleEditor extends connect(store)(LitElement) {
|
|
|
113
113
|
? html`
|
|
114
114
|
<li>
|
|
115
115
|
<span>
|
|
116
|
-
<md-icon>email</md-icon>
|
|
117
|
-
${user.email}
|
|
116
|
+
${user.username || user.email} (<md-icon>email</md-icon>
|
|
117
|
+
${user.email})
|
|
118
118
|
</span>
|
|
119
119
|
</li>
|
|
120
120
|
`
|
|
@@ -330,8 +330,8 @@ class UserRoleEditor extends connect(store)(LitElement) {
|
|
|
330
330
|
if (user?.id) {
|
|
331
331
|
const response = await client.mutate({
|
|
332
332
|
mutation: gql`
|
|
333
|
-
mutation ($
|
|
334
|
-
updateUserRoles(
|
|
333
|
+
mutation ($username: String!, $availableRoles: [ObjectRef!]!, $selectedRoles: [ObjectRef!]!) {
|
|
334
|
+
updateUserRoles(username: $username, availableRoles: $availableRoles, selectedRoles: $selectedRoles) {
|
|
335
335
|
id
|
|
336
336
|
name
|
|
337
337
|
roles {
|
|
@@ -341,7 +341,7 @@ class UserRoleEditor extends connect(store)(LitElement) {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
`,
|
|
344
|
-
variables: {
|
|
344
|
+
variables: { username: user.username || user.email, availableRoles, selectedRoles },
|
|
345
345
|
context: gqlContext()
|
|
346
346
|
})
|
|
347
347
|
|
|
@@ -355,11 +355,11 @@ class UserRoleEditor extends connect(store)(LitElement) {
|
|
|
355
355
|
async onActivate(user) {
|
|
356
356
|
const response = await client.mutate({
|
|
357
357
|
mutation: gql`
|
|
358
|
-
mutation activateUser($
|
|
359
|
-
activateUser(
|
|
358
|
+
mutation activateUser($username: String!) {
|
|
359
|
+
activateUser(username: $username)
|
|
360
360
|
}
|
|
361
361
|
`,
|
|
362
|
-
variables: {
|
|
362
|
+
variables: { username: user.username || user.email },
|
|
363
363
|
context: gqlContext()
|
|
364
364
|
})
|
|
365
365
|
|
|
@@ -373,16 +373,16 @@ class UserRoleEditor extends connect(store)(LitElement) {
|
|
|
373
373
|
async onInactivate(user) {
|
|
374
374
|
const response = await client.mutate({
|
|
375
375
|
mutation: gql`
|
|
376
|
-
mutation inactivateUser($
|
|
377
|
-
inactivateUser(
|
|
376
|
+
mutation inactivateUser($username: String!) {
|
|
377
|
+
inactivateUser(username: $username)
|
|
378
378
|
}
|
|
379
379
|
`,
|
|
380
|
-
variables: {
|
|
380
|
+
variables: { username: user.username || user.email },
|
|
381
381
|
context: gqlContext()
|
|
382
382
|
})
|
|
383
383
|
|
|
384
384
|
if (!response.errors) {
|
|
385
|
-
this.showToast(i18next.t('text.user
|
|
385
|
+
this.showToast(i18next.t('text.user inactivated successfully'))
|
|
386
386
|
|
|
387
387
|
this.dispatchUserUpdated()
|
|
388
388
|
}
|
|
@@ -414,11 +414,11 @@ class UserRoleEditor extends connect(store)(LitElement) {
|
|
|
414
414
|
) {
|
|
415
415
|
const response = await client.mutate({
|
|
416
416
|
mutation: gql`
|
|
417
|
-
mutation deleteDomaineUser($
|
|
418
|
-
deleteDomainUser(
|
|
417
|
+
mutation deleteDomaineUser($username: String!) {
|
|
418
|
+
deleteDomainUser(username: $username)
|
|
419
419
|
}
|
|
420
420
|
`,
|
|
421
|
-
variables: {
|
|
421
|
+
variables: { username: user.username || user.email },
|
|
422
422
|
context: gqlContext()
|
|
423
423
|
})
|
|
424
424
|
|
|
@@ -460,11 +460,11 @@ class UserRoleEditor extends connect(store)(LitElement) {
|
|
|
460
460
|
) {
|
|
461
461
|
const response = await client.mutate({
|
|
462
462
|
mutation: gql`
|
|
463
|
-
mutation resetPasswordToDefault($
|
|
464
|
-
resetPasswordToDefault(
|
|
463
|
+
mutation resetPasswordToDefault($username: String!) {
|
|
464
|
+
resetPasswordToDefault(username: $username)
|
|
465
465
|
}
|
|
466
466
|
`,
|
|
467
|
-
variables: {
|
|
467
|
+
variables: { username: user.username || user.email },
|
|
468
468
|
context: gqlContext()
|
|
469
469
|
})
|
|
470
470
|
|
|
@@ -98,14 +98,12 @@ export class UserManagement extends localize(i18next)(PageView) {
|
|
|
98
98
|
.data=${userSet}
|
|
99
99
|
@tabChanged=${e => (this.currentTab = e.detail.currentTabKey)}
|
|
100
100
|
.headerRenderer=${user => {
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
: html` ${user.owner ? html` <md-icon>supervisor_account</md-icon> ` : ''} ${user.name} `}
|
|
108
|
-
`
|
|
101
|
+
return !user.activated
|
|
102
|
+
? html`
|
|
103
|
+
<md-icon>do_disturb</md-icon>
|
|
104
|
+
${user.name}
|
|
105
|
+
`
|
|
106
|
+
: html` ${user.owner ? html` <md-icon>supervisor_account</md-icon> ` : ''} ${user.name} `
|
|
109
107
|
}}
|
|
110
108
|
.contentRenderer=${user =>
|
|
111
109
|
html` <user-role-editor
|
|
@@ -139,6 +137,7 @@ export class UserManagement extends localize(i18next)(PageView) {
|
|
|
139
137
|
users {
|
|
140
138
|
items {
|
|
141
139
|
id
|
|
140
|
+
username
|
|
142
141
|
name
|
|
143
142
|
email
|
|
144
143
|
userType
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import '@material/web/icon/icon.js';
|
|
2
2
|
import '@material/web/button/elevated-button.js';
|
|
3
3
|
import '@material/web/textfield/filled-text-field.js';
|
|
4
|
-
import '@operato/lottie-player';
|
|
5
|
-
import '../components/profile-component';
|
|
6
4
|
import '@operato/i18n/ox-i18n.js';
|
|
7
5
|
import '@operato/i18n/ox-i18n-selector.js';
|
|
8
6
|
import '@operato/layout/ox-snack-bar.js';
|
|
7
|
+
import '../components/profile-component';
|
|
9
8
|
import { AbstractAuthPage } from './abstract-auth-page';
|
|
10
9
|
export declare abstract class AbstractPasswordReset extends AbstractAuthPage {
|
|
11
10
|
static styles: import("lit").CSSResult[];
|
|
@@ -2,15 +2,13 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import '@material/web/icon/icon.js';
|
|
3
3
|
import '@material/web/button/elevated-button.js';
|
|
4
4
|
import '@material/web/textfield/filled-text-field.js';
|
|
5
|
-
import '@operato/lottie-player';
|
|
6
|
-
import '../components/profile-component';
|
|
7
5
|
import '@operato/i18n/ox-i18n.js';
|
|
8
6
|
import '@operato/i18n/ox-i18n-selector.js';
|
|
9
7
|
import '@operato/layout/ox-snack-bar.js';
|
|
8
|
+
import '../components/profile-component';
|
|
10
9
|
import { css, html, nothing } from 'lit';
|
|
11
10
|
import { property, query } from 'lit/decorators.js';
|
|
12
11
|
import { i18next } from '@operato/i18n';
|
|
13
|
-
import { isSafari } from '@operato/utils';
|
|
14
12
|
import { AUTH_STYLE_SIGN } from '../auth-style-sign';
|
|
15
13
|
import { generatePasswordPatternHelp, generatePasswordPatternRegExp } from '../utils/password-rule';
|
|
16
14
|
import { AbstractAuthPage } from './abstract-auth-page';
|
|
@@ -95,15 +93,8 @@ export class AbstractPasswordReset extends AbstractAuthPage {
|
|
|
95
93
|
</form>
|
|
96
94
|
</div>
|
|
97
95
|
</div>
|
|
98
|
-
<ox-snack-bar id="snackbar" level="error" .message=${this.message}></ox-snack-bar>
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
? html ``
|
|
102
|
-
: html `
|
|
103
|
-
<div class="lottie-container">
|
|
104
|
-
<lottie-player autoplay loop src="../../assets/images/background-animation.json"></lottie-player>
|
|
105
|
-
</div>
|
|
106
|
-
`}
|
|
97
|
+
<ox-snack-bar id="snackbar" level="error" .message=${this.message}></ox-snack-bar>
|
|
107
98
|
`;
|
|
108
99
|
}
|
|
109
100
|
updated(changed) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-password-reset.js","sourceRoot":"","sources":["../../client/components/abstract-password-reset.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,8CAA8C,CAAA;AAErD,OAAO,
|
|
1
|
+
{"version":3,"file":"abstract-password-reset.js","sourceRoot":"","sources":["../../client/components/abstract-password-reset.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,yCAAyC,CAAA;AAChD,OAAO,8CAA8C,CAAA;AAErD,OAAO,0BAA0B,CAAA;AACjC,OAAO,mCAAmC,CAAA;AAC1C,OAAO,iCAAiC,CAAA;AAExC,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AACnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,OAAgB,qBAAsB,SAAQ,gBAAgB;IAApE;;QAgCU,oBAAe,GAAW,EAAE,CAAA;QAC5B,iBAAY,GAAW,EAAE,CAAA;IA8GnC,CAAC;IA1GC,MAAM;QACJ,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,eAAe,CAAA;QACvD,MAAM,EAAE,0BAA0B,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAA;QAEjE,OAAO,IAAI,CAAA;;;qBAGM,IAAI;iCACQ,KAAK;sCACA,WAAW;;;;sCAIX,IAAI,CAAC,KAAK;;;s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IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAA;QAC9B,CAAC;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,IAAI,CAAC,YAAY,EAAE,CAAA;YACrB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,YAAY,CAAC;oBAChB,KAAK,EAAE,CAAC,CAAC;iBACV,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,eAAe;QACb,IAAI,CAAC,eAAe,GAAG,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAA;QACnF,IAAI,CAAC,YAAY,GAAG,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACzE,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;IACtB,CAAC;;AA7IM,4BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;KAqBF;IACD,eAAe;CAChB,AAxBY,CAwBZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAU;AACT;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAe;AAEd;IAA3B,KAAK,CAAC,mBAAmB,CAAC;8BAAe,WAAW;0DAAA","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@material/web/button/elevated-button.js'\nimport '@material/web/textfield/filled-text-field.js'\n\nimport '@operato/i18n/ox-i18n.js'\nimport '@operato/i18n/ox-i18n-selector.js'\nimport '@operato/layout/ox-snack-bar.js'\n\nimport '../components/profile-component'\n\nimport { css, html, nothing } from 'lit'\nimport { property, query } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { AUTH_STYLE_SIGN } from '../auth-style-sign'\nimport { generatePasswordPatternHelp, generatePasswordPatternRegExp } from '../utils/password-rule'\nimport { AbstractAuthPage } from './abstract-auth-page'\n\nexport abstract class AbstractPasswordReset extends AbstractAuthPage {\n static styles = [\n css`\n :host {\n position: relative;\n overflow: hidden;\n\n display: flex;\n flex-direction: row;\n\n width: 100vw;\n height: 100vh;\n height: 100dvh;\n }\n\n @media print {\n :host {\n width: 100%;\n height: 100%;\n min-height: 100vh;\n min-height: 100dvh;\n }\n }\n `,\n AUTH_STYLE_SIGN\n ]\n\n @property({ type: Object }) data: any\n @property({ type: String }) token?: string\n\n @query('#confirm-password') confirmPass!: HTMLElement\n\n private passwordPattern: string = ''\n private passwordHelp: string = ''\n\n abstract get submitButtonLabel(): string\n\n render() {\n var { icon, title, description } = this.applicationMeta\n const { disableUserFavoredLanguage, languages } = this.data || {}\n\n return html`\n <div class=\"wrap\">\n <div class=\"auth-brand\">\n <img src=${icon} />\n <strong class=\"name\">${title}</strong>\n <span class=\"welcome-msg\">${description}</span>\n </div>\n\n <div class=\"auth-form\">\n <h3><ox-i18n msgid=\"title.${this.title}\"></ox-i18n></h3>\n <form\n id=\"form\"\n action=\"${this.actionUrl}\"\n method=\"post\"\n @keypress=${e => {\n if (e.key == 'Enter') this._onSubmit(e)\n }}\n >\n <input name=\"token\" type=\"hidden\" .value=${this.token || ''} required />\n <div class=\"field\">\n <md-filled-text-field\n name=\"password\"\n type=\"password\"\n label=${String(i18next.t('label.password'))}\n pattern=${this.passwordPattern || ''}\n supporting-text=${this.passwordHelp}\n autocomplete=\"off\"\n @input=${e => {\n var val = e.target.value\n this.confirmPass.setAttribute('pattern', val.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, '[$&]'))\n }}\n required\n ><md-icon slot=\"leading-icon\">password</md-icon></md-filled-text-field\n >\n </div>\n\n <div class=\"field\">\n <md-filled-text-field\n id=\"confirm-password\"\n name=\"confirm-password\"\n type=\"password\"\n label=${String(i18next.t('field.confirm password'))}\n autocomplete=\"off\"\n required\n ><md-icon slot=\"leading-icon\">password</md-icon></md-filled-text-field\n >\n </div>\n\n <md-elevated-button id=\"submit-button\" type=\"button\" @click=${e => this._onSubmit(e)}>\n <ox-i18n msgid=\"${this.submitButtonLabel}\"></ox-i18n>\n </md-elevated-button>\n\n ${!disableUserFavoredLanguage\n ? html` <div id=\"locale-area\">\n <label for=\"locale-selector\"><md-icon>language</md-icon></label>\n <ox-i18n-selector\n id=\"locale-selector\"\n value=${i18next.language || 'en-US'}\n .languages=${languages}\n @change=${e => {\n var locale = e.detail\n if (!locale) return\n\n i18next.changeLanguage(locale)\n }}\n ></ox-i18n-selector>\n </div>`\n : nothing}\n </form>\n </div>\n </div>\n\n <ox-snack-bar id=\"snackbar\" level=\"error\" .message=${this.message}></ox-snack-bar>\n `\n }\n\n updated(changed) {\n super.updated(changed)\n\n if (changed.has('data')) {\n this.token = this.data.token\n }\n\n if (changed.has('message')) {\n if (!this.message) {\n this.hideSnackbar()\n } else {\n this.showSnackbar({\n timer: -1\n })\n }\n }\n }\n\n languageUpdated() {\n this.passwordPattern = generatePasswordPatternRegExp(this.data.passwordRule).source\n this.passwordHelp = generatePasswordPatternHelp(this.data.passwordRule)\n }\n\n async submit() {\n this.formEl.submit()\n }\n}\n"]}
|
|
@@ -47,14 +47,14 @@ let InviteUser = class InviteUser extends localize(i18next)(LitElement) {
|
|
|
47
47
|
}));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
async inviteUser(
|
|
50
|
+
async inviteUser(username) {
|
|
51
51
|
const response = await client.mutate({
|
|
52
52
|
mutation: gql `
|
|
53
|
-
mutation inviteUser($
|
|
54
|
-
inviteUser(
|
|
53
|
+
mutation inviteUser($username: String!) {
|
|
54
|
+
inviteUser(username: $username)
|
|
55
55
|
}
|
|
56
56
|
`,
|
|
57
|
-
variables: {
|
|
57
|
+
variables: { username },
|
|
58
58
|
context: gqlContext()
|
|
59
59
|
});
|
|
60
60
|
if (!response.errors) {
|
|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oBACN,KAAK,EAAE,OAAO;oBACd,OAAO,EAAE,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;iBACxC;aACF,CAAC,CACH,CAAA;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAQ;QACvB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACnC,QAAQ,EAAE,GAAG,CAAA;;;;OAIZ;YACD,SAAS,EAAE,EAAE,QAAQ,EAAE;YACvB,OAAO,EAAE,UAAU,EAAE;SACtB,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,MAAM,QAAQ,CAAC,IAAI,CAAC;gBAClB,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;gBAClC,aAAa,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,EAAE;aACrD,CAAC,CAAA;YAEF,IAAI,CAAC,WAAW,CAAC,KAAK,GAAG,EAAE,CAAA;QAC7B,CAAC;IACH,CAAC;;AA1FM,iBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;GAoBlB,AApBY,CAoBZ;AAE8B;IAA9B,KAAK,CAAC,sBAAsB,CAAC;8BAAe,gBAAgB;+CAAA;AAvBzD,UAAU;IADf,aAAa,CAAC,aAAa,CAAC;GACvB,UAAU,CA4Ff","sourcesContent":["import './user-role-editor'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, query } from 'lit/decorators.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\n@customElement('invite-user')\nclass InviteUser extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: grid;\n }\n\n input {\n flex: 1;\n\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n min-width: 250px;\n font: var(--input-font);\n }\n\n md-outlined-button {\n margin: var(--input-margin);\n text-transform: capitalize;\n }\n `\n\n @query('input[name=username]') userIdInput!: HTMLInputElement\n\n render() {\n return html`\n <input\n name=\"username\"\n type=\"text\"\n required\n name=\"username\"\n autocapitalize=\"off\"\n placeholder=${String(i18next.t('text.user invitation prompt'))}\n pattern=\"^(?:[A-Za-z0-9]*|[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,})$\"\n />\n <md-outlined-button @click=${this.invite.bind(this)}>\n <md-icon slot=\"icon\">group_add</md-icon>${String(i18next.t('label.invite user'))}\n </md-outlined-button>\n `\n }\n\n async invite() {\n try {\n if (!this.userIdInput.checkValidity()) {\n throw new Error(i18next.t('error.not valid pattern of type', { type: 'user-id or email' }))\n }\n\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.do_you_want_to_invite_x', { x: i18next.t(`label.user`) }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n await this.inviteUser(this.userIdInput.value)\n\n this.dispatchEvent(new CustomEvent('invitationCompleted'))\n }\n } catch (e: any) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: 'message' in e ? e.message : e\n }\n })\n )\n }\n }\n\n async inviteUser(username) {\n const response = await client.mutate({\n mutation: gql`\n mutation inviteUser($username: String!) {\n inviteUser(username: $username)\n }\n `,\n variables: { username },\n context: gqlContext()\n })\n\n if (!response.errors) {\n await OxPrompt.open({\n title: i18next.t('text.completed'),\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n this.userIdInput.value = ''\n }\n }\n}\n"]}
|
|
@@ -32,11 +32,11 @@ let OwnershipTransferPopup = class OwnershipTransferPopup extends localize(i18ne
|
|
|
32
32
|
})) {
|
|
33
33
|
const response = await client.mutate({
|
|
34
34
|
mutation: gql `
|
|
35
|
-
mutation transferOwner($
|
|
36
|
-
transferOwner(
|
|
35
|
+
mutation transferOwner($username: String!) {
|
|
36
|
+
transferOwner(username: $username)
|
|
37
37
|
}
|
|
38
38
|
`,
|
|
39
|
-
variables: {
|
|
39
|
+
variables: { username: this.user.username || this.user.email },
|
|
40
40
|
context: gqlContext()
|
|
41
41
|
});
|
|
42
42
|
if (!((_a = response.errors) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ownership-transfer-popup.js","sourceRoot":"","sources":["../../client/components/ownership-transfer-popup.ts"],"names":[],"mappings":";AAAA,OAAO,yCAAyC,CAAA;AAEhD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGtD,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC;IAqChE,MAAM;QACJ,OAAO,IAAI,CAAA;;eAEA,OAAO,CAAC,CAAC,CAAC,oEAAoE,CAAC;;;uCAGvD,IAAI,CAAC,iBAAiB,IAAI,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;;;KAGvF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,iBAAiB;;QACrB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAA;YAEtD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CAAC,sBAAsB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;YAChG,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,EAAE,CAAA;QAChB,CAAC;IACH,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAA;IAClD,CAAC;IAED,SAAS,CAAC,OAAO;QACf,QAAQ,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IACrG,CAAC;;AAhGM,6BAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BF;CACF,AA9BY,CA8BZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAU;AAET;IAA3B,KAAK,CAAC,mBAAmB,CAAC;8BAAc,gBAAgB;0DAAA;AAnCrD,sBAAsB;IAD3B,aAAa,CAAC,0BAA0B,CAAC;GACpC,sBAAsB,CAkG3B","sourcesContent":["import '@material/web/button/elevated-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\n@customElement('ownership-transfer-popup')\nclass OwnershipTransferPopup extends localize(i18next)(LitElement) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n overflow: auto;\n }\n .container {\n display: flex;\n flex-direction: column;\n flex: 1;\n }\n input {\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n margin: var(--input-margin);\n padding: var(--input-padding);\n min-width: 250px;\n font: var(--input-font);\n }\n .input-container {\n margin: auto;\n display: flex;\n }\n .input-container md-elevated-button {\n margin: auto 0px auto var(--spacing-large);\n }\n `\n ]\n\n @property({ type: Object }) user: any\n\n @query('input[name=email]') emailInput!: HTMLInputElement\n\n render() {\n return html`\n <div class=\"container\">\n <div>${i18next.t('text.please enter the email of the user you want to transfer owner')}</div>\n <div class=\"input-container\">\n <input name=\"email\" />\n <md-elevated-button @click=${this.transferOwnership}>${i18next.t('button.confirm')}</md-elevated-button>\n </div>\n </div>\n `\n }\n\n async transferOwnership() {\n if (!this.doubleCheckEmail()) {\n this.showToast(i18next.t('text.email is not matched'))\n\n return\n }\n\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.are_you_sure_to_transfer_owner'),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const response = await client.mutate({\n mutation: gql`\n mutation transferOwner($username: String!) {\n transferOwner(username: $username)\n }\n `,\n variables: { username: this.user.username || this.user.email },\n context: gqlContext()\n })\n\n if (!response.errors?.length) {\n await OxPrompt.open({\n type: 'success',\n title: i18next.t('text.completed'),\n text: i18next.t('text.owner_transfer_completed'),\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n history.back()\n\n this.dispatchEvent(new CustomEvent('ownershipTransferred', { bubbles: true, composed: true }))\n }\n } else {\n history.back()\n }\n }\n\n doubleCheckEmail() {\n return this.emailInput.value === this.user.email\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import gql from 'graphql-tag';
|
|
3
3
|
import { css, html, LitElement } from 'lit';
|
|
4
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
5
5
|
import { client, gqlContext } from '@operato/graphql';
|
|
6
6
|
import { i18next, localize } from '@operato/i18n';
|
|
7
7
|
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
@@ -11,11 +11,19 @@ let RolePrivilegeEditor = class RolePrivilegeEditor extends localize(i18next)(Li
|
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.allPrivileges = [];
|
|
13
13
|
this.privileges = [];
|
|
14
|
+
this.users = [];
|
|
14
15
|
}
|
|
15
16
|
render() {
|
|
16
17
|
const allPrivileges = this.allPrivileges || [];
|
|
17
18
|
const privileges = this.privileges || [];
|
|
19
|
+
const users = this.users || [];
|
|
18
20
|
return html `
|
|
21
|
+
<div titler>${String(i18next.t('label.user'))}</div>
|
|
22
|
+
|
|
23
|
+
<div users>${users.map(user => html `<div>${user.name} (${user.email})</div>`)}</div>
|
|
24
|
+
|
|
25
|
+
<div titler>${String(i18next.t('field.privileges'))}</div>
|
|
26
|
+
|
|
19
27
|
<div>
|
|
20
28
|
<input id="checkAll" type="checkbox" @change=${e => this.oncheckAll(e)} />
|
|
21
29
|
<label for="checkAll">Check all</label>
|
|
@@ -48,7 +56,7 @@ let RolePrivilegeEditor = class RolePrivilegeEditor extends localize(i18next)(Li
|
|
|
48
56
|
}
|
|
49
57
|
async updated(changes) {
|
|
50
58
|
if (changes.has('role')) {
|
|
51
|
-
|
|
59
|
+
await this.fetchPrivilegesOnRole(this.role.name);
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
62
|
checkAll(checked) {
|
|
@@ -130,7 +138,7 @@ let RolePrivilegeEditor = class RolePrivilegeEditor extends localize(i18next)(Li
|
|
|
130
138
|
return response.data.privileges.items;
|
|
131
139
|
}
|
|
132
140
|
async fetchPrivilegesOnRole(name) {
|
|
133
|
-
var _a;
|
|
141
|
+
var _a, _b;
|
|
134
142
|
const response = await client.query({
|
|
135
143
|
query: gql `
|
|
136
144
|
query ($name: String!) {
|
|
@@ -141,13 +149,18 @@ let RolePrivilegeEditor = class RolePrivilegeEditor extends localize(i18next)(Li
|
|
|
141
149
|
id
|
|
142
150
|
description
|
|
143
151
|
}
|
|
152
|
+
users {
|
|
153
|
+
name
|
|
154
|
+
email
|
|
155
|
+
}
|
|
144
156
|
}
|
|
145
157
|
}
|
|
146
158
|
`,
|
|
147
159
|
variables: { name },
|
|
148
160
|
context: gqlContext()
|
|
149
161
|
});
|
|
150
|
-
|
|
162
|
+
this.privileges = (_a = response.data.role) === null || _a === void 0 ? void 0 : _a.privileges;
|
|
163
|
+
this.users = (_b = response.data.role) === null || _b === void 0 ? void 0 : _b.users;
|
|
151
164
|
}
|
|
152
165
|
showToast(message) {
|
|
153
166
|
document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }));
|
|
@@ -168,6 +181,17 @@ RolePrivilegeEditor.styles = [
|
|
|
168
181
|
margin: var(--spacing-medium);
|
|
169
182
|
}
|
|
170
183
|
|
|
184
|
+
div[users] {
|
|
185
|
+
margin: 0;
|
|
186
|
+
background-color: var(--md-sys-color-surface-variant);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
div[titler] {
|
|
190
|
+
color: var(--md-sys-color-secondary);
|
|
191
|
+
font: bold 1.2em var(--theme-font);
|
|
192
|
+
text-transform: capitalize;
|
|
193
|
+
}
|
|
194
|
+
|
|
171
195
|
ul {
|
|
172
196
|
flex: 1;
|
|
173
197
|
color: var(--md-sys-color-secondary);
|
|
@@ -175,7 +199,8 @@ RolePrivilegeEditor.styles = [
|
|
|
175
199
|
overflow: auto;
|
|
176
200
|
display: grid;
|
|
177
201
|
grid-template-columns: 1fr 1fr;
|
|
178
|
-
margin: 0;
|
|
202
|
+
margin-block-start: 0;
|
|
203
|
+
margin-block-end: 0;
|
|
179
204
|
padding: var(--spacing-medium);
|
|
180
205
|
list-style: none;
|
|
181
206
|
border: 1px dashed rgba(0, 0, 0, 0.1);
|
|
@@ -221,14 +246,18 @@ __decorate([
|
|
|
221
246
|
property({ type: Array }),
|
|
222
247
|
__metadata("design:type", Array)
|
|
223
248
|
], RolePrivilegeEditor.prototype, "allPrivileges", void 0);
|
|
224
|
-
__decorate([
|
|
225
|
-
property({ type: Array }),
|
|
226
|
-
__metadata("design:type", Array)
|
|
227
|
-
], RolePrivilegeEditor.prototype, "privileges", void 0);
|
|
228
249
|
__decorate([
|
|
229
250
|
property({ type: Object }),
|
|
230
251
|
__metadata("design:type", Object)
|
|
231
252
|
], RolePrivilegeEditor.prototype, "updateRoleObj", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
state(),
|
|
255
|
+
__metadata("design:type", Array)
|
|
256
|
+
], RolePrivilegeEditor.prototype, "privileges", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
state(),
|
|
259
|
+
__metadata("design:type", Array)
|
|
260
|
+
], RolePrivilegeEditor.prototype, "users", void 0);
|
|
232
261
|
RolePrivilegeEditor = __decorate([
|
|
233
262
|
customElement('role-privilege-editor')
|
|
234
263
|
], RolePrivilegeEditor);
|