-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstrolch-wc-privilege-dialog.html
More file actions
162 lines (134 loc) · 5.82 KB
/
strolch-wc-privilege-dialog.html
File metadata and controls
162 lines (134 loc) · 5.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-ajax/iron-ajax.html">
<link rel="import" href="../iron-pages/iron-pages.html">
<link rel="import" href="../iron-icons/iron-icons.html">
<link rel="import" href="../paper-styles/color.html">
<link rel="import" href="../paper-material/paper-material.html">
<link rel="import" href="../paper-dialog/paper-dialog.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../paper-listbox/paper-listbox.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../strolch-wc-styles/strolch-wc-styles.html">
<link rel="import" href="strolch-wc-inspector-behavior.html">
<dom-module id="strolch-wc-privilege-dialog">
<template>
<style is="custom-style" include="strolch-wc-styles">
:host {
display: block;
margin: 0;
padding: 0;
}
.privilege {
margin-top: 8px;
display: flex;
flex-direction: column;
}
.privilege p {
margin: 0;
}
</style>
<paper-dialog id="dlg" modal>
<h2>Privileges for [[element.username]]</h2>
<template is="dom-if" if="[[isUser]]">
<p>The following are all the resolved privileges which the user has according to the assigned groups and
roles.</p></template>
<template is="dom-if" if="[[!isUser]]">
<p>The following are all the resolved privileges which the group has according to the assigned
roles.</p>
</template>
<paper-dialog-scrollable class="dialog-content">
<div class="table">
<template is="dom-repeat" items="[[privileges]]" as="privilege">
<div class="table-row privilege">
<p><b>[[privilege.name]]</b></p>
<p>Policy: [[privilege.policy]]</p>
<p>All allowed: [[privilege.allAllowed]]</p>
<template is="dom-if" if="[[!privilege.allAllowed]]">
<template is="dom-if" if="[[!computeHasAllows(privilege)]]">
<p>Allow List: <i>none</i></p>
</template>
<template is="dom-if" if="[[computeHasAllows(privilege)]]">
<p>Allow List:</p>
<ul>
<template is="dom-repeat" items="[[privilege.allowList]]">
<li>[[item]]</li>
</template>
</ul>
</template>
<template is="dom-if" if="[[!computeHasDenies(privilege)]]">
<p>Deny List: <i>none</i></p>
</template>
<template is="dom-if" if="[[computeHasDenies(privilege)]]">
<p>Deny List:</p>
<ul>
<template is="dom-repeat" items="[[privilege.denyList]]">
<li>[[item]]</li>
</template>
</ul>
</template>
</template>
</div>
</template>
</div>
</paper-dialog-scrollable>
<div class="buttons">
<paper-button autofocus on-tap="close">Close</paper-button>
</div>
</paper-dialog>
</template>
<script>
Polymer({
is: 'strolch-wc-privilege-dialog',
behaviors: [
StrolchInspectorBehavior
],
properties: {
element: {
type: Object,
value: null
},
name: {
type: String,
computed: "computeName(element)"
},
isUser: {
type: Boolean,
computed: "computeIsUser(element)"
},
privileges: {
type: Array,
value: []
},
},
computeName: function (element) {
if (element == null) return "";
if (element.username)
return element.username;
return element.name;
},
computeIsUser: function (element) {
return element != null && element.username != null
},
computeHasAllows: function (privilege) {
return this.isNotEmptyArray(privilege.allowList);
},
computeHasDenies: function (privilege) {
return this.isNotEmptyArray(privilege.denyList);
},
open: function (element) {
this.element = element;
this.privileges = element.privileges;
this.$.dlg.open();
},
close: function () {
this.privileges = [];
this.$.dlg.close();
},
});
</script>
</dom-module>