1 | @using HeuristicLab.Clients.Hive.WebJobManager.ViewModels.User;
|
---|
2 | @model UserViewModel
|
---|
3 | <div id="userId" style="display:none">@ViewBag.SessionId</div>
|
---|
4 | <div class="animated fadeIn">
|
---|
5 |
|
---|
6 | @Html.Partial("Navbar", new HeuristicLab.Clients.Hive.WebJobManager.ViewModels.NavbarViewModel("User", Model.User))
|
---|
7 |
|
---|
8 | <ul class="nav nav-pills nav-justified">
|
---|
9 | <li role="presentation"
|
---|
10 | class="active">
|
---|
11 | <a asp-controller="User"
|
---|
12 | asp-action="Index">
|
---|
13 | <i class="fa fa-user"></i> Users
|
---|
14 | </a>
|
---|
15 | </li>
|
---|
16 | <li role="presentation"
|
---|
17 | class="">
|
---|
18 | <a asp-controller="User"
|
---|
19 | asp-action="Groups">
|
---|
20 | <i class="fa fa-group"></i> Groups
|
---|
21 | </a>
|
---|
22 | </li>
|
---|
23 | <li role="presentation"
|
---|
24 | class="">
|
---|
25 | <a asp-controller="User"
|
---|
26 | asp-action="Roles">
|
---|
27 | <i class="fa fa-gavel"></i> Roles
|
---|
28 | </a>
|
---|
29 | </li>
|
---|
30 | </ul>
|
---|
31 | @Html.Partial("_ErrorMessage", Model.message)
|
---|
32 |
|
---|
33 | <div class="row"
|
---|
34 | style="padding:10px; margin-right:0px!important">
|
---|
35 | @if (Model.users.Count == 0)
|
---|
36 | {
|
---|
37 | <div>
|
---|
38 | <p style="text-align:center">
|
---|
39 | No users found
|
---|
40 | </p>
|
---|
41 | </div>
|
---|
42 |
|
---|
43 | }
|
---|
44 | else
|
---|
45 | {
|
---|
46 | <div class="col-sm-4">
|
---|
47 | <div class="btn-group btn-group-justified btn-block"
|
---|
48 | role="group" style="margin-bottom:-4px">
|
---|
49 |
|
---|
50 | <a class="btn btn-info btn-lg disabled"
|
---|
51 | style="width:6%;box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
52 | text-shadow:2px 2px black;">
|
---|
53 | <i class="fa fa-user"></i> @Model.users.Count User@(Model.users.Count != 1 ? "s" : "")
|
---|
54 | </a>
|
---|
55 | <a class="btn btn-success
|
---|
56 | @(Model.SelectedUser.Id == Guid.Empty ? "active" : "")
|
---|
57 | "
|
---|
58 | style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
59 | text-shadow:2px 2px black;"
|
---|
60 | asp-controller="User"
|
---|
61 | asp-action="SelectUser"
|
---|
62 | asp-route-id="@Guid.Empty"
|
---|
63 | onclick="showUser()">
|
---|
64 | <i class="fa fa-user-plus"></i>
|
---|
65 | </a>
|
---|
66 | </div>
|
---|
67 | <div class="btn-group-vertical btn-block">
|
---|
68 |
|
---|
69 |
|
---|
70 | @foreach (var user in Model.users.OrderBy(x => x.UserName))
|
---|
71 | {
|
---|
72 | <a class="btn btn-default @( user.Id == Model.SelectedUser.Id ? "active" : "" )"
|
---|
73 | style="box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);"
|
---|
74 | asp-controller="User"
|
---|
75 | asp-action="SelectUser"
|
---|
76 | asp-route-id="@user.Id"
|
---|
77 | onclick="showUser()">
|
---|
78 | @user.UserName (@user.FullName)
|
---|
79 | </a>
|
---|
80 | }
|
---|
81 | </div>
|
---|
82 | </div>
|
---|
83 | <p style="display:none"
|
---|
84 | id="saver"
|
---|
85 | class="text-center">
|
---|
86 | <br /><br /><br /><br /><br /><br /><br />
|
---|
87 | <i class="fa fa-save fa-spin fa-5x" id="spinner">
|
---|
88 | </i>
|
---|
89 | </p>
|
---|
90 | <p style="display:none"
|
---|
91 | id="user"
|
---|
92 | class="text-center">
|
---|
93 | <br /><br /><br /><br /><br /><br /><br />
|
---|
94 | <i class="fa fa-user fa-spin fa-5x" id="spinner">
|
---|
95 | </i>
|
---|
96 | </p>
|
---|
97 | <p style="display:none"
|
---|
98 | id="deleter"
|
---|
99 | class="text-center">
|
---|
100 | <br /><br /><br /><br /><br /><br /><br />
|
---|
101 | <i class="fa fa-trash-o fa-spin fa-5x" id="spinner">
|
---|
102 | </i>
|
---|
103 | </p>
|
---|
104 | <div class="col-sm-8"
|
---|
105 | id="content"
|
---|
106 | style="padding:5px; padding-left:10px;">
|
---|
107 | <div class="panel panel-default"
|
---|
108 | style="border-width:2px!important;padding:17px;
|
---|
109 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
|
---|
110 | <div class="row">
|
---|
111 | @if (Model.SelectedUser.Id != Guid.Empty && Model.SelectedUser.IsApproved)
|
---|
112 | {<div class="row" style="margin-right:20px">
|
---|
113 | <a class="btn btn-success pull-right disabled"><i class="fa fa-check-square-o "></i> Approved</a>
|
---|
114 | </div>
|
---|
115 | }
|
---|
116 | else if (Model.SelectedUser.Id != Guid.Empty && !Model.SelectedUser.IsApproved)
|
---|
117 | {<div class="row" style="margin-right:20px">
|
---|
118 | <a class="btn btn-warning pull-right"
|
---|
119 | asp-action="approveUser"
|
---|
120 | asp-controller="User"
|
---|
121 | asp-route-id="@Model.SelectedUser.Id">
|
---|
122 | <i class="fa fa-square-o" ></i> Not approved
|
---|
123 | </a>
|
---|
124 |
|
---|
125 | </div>
|
---|
126 | }
|
---|
127 | <h2 style="padding-left:20px; margin-top:0">
|
---|
128 | @if (Model.SelectedUser.Id != Guid.Empty)
|
---|
129 | {
|
---|
130 | <i class="fa fa-user "></i> @Model.SelectedUser.UserName
|
---|
131 |
|
---|
132 | }
|
---|
133 | else
|
---|
134 | {
|
---|
135 | <i class="fa fa-user-plus "></i> @("Add new user")
|
---|
136 |
|
---|
137 | }
|
---|
138 | </h2>
|
---|
139 |
|
---|
140 | <form class="form-horizontal"
|
---|
141 | method="post"
|
---|
142 | asp-action="saveUser"
|
---|
143 | asp-controller="User"
|
---|
144 | enctype="multipart/form-data"
|
---|
145 | onsubmit="showSaver()">
|
---|
146 | <div class="form-group" style="@(Model.SelectedUser.Id == Guid.Empty ? "" : "display:none")">
|
---|
147 | <label for="inpusername"
|
---|
148 | class="col-sm-3 control-label">
|
---|
149 | Username
|
---|
150 | </label>
|
---|
151 | <div class="col-sm-8">
|
---|
152 | <input type="text"
|
---|
153 | class="form-control"
|
---|
154 | id="inpusername"
|
---|
155 | name="inpusername"
|
---|
156 | placeholder="Username"
|
---|
157 | onkeydown="triggerSave()"
|
---|
158 | value="@Model.SelectedUser.UserName">
|
---|
159 | </div>
|
---|
160 | </div>
|
---|
161 | <div class="form-group">
|
---|
162 | <label for="inpfullname"
|
---|
163 | class="col-sm-3 control-label">
|
---|
164 | Full name
|
---|
165 | </label>
|
---|
166 | <div class="col-sm-8">
|
---|
167 | <input type="text"
|
---|
168 | class="form-control"
|
---|
169 | id="inpfullname"
|
---|
170 | name="inpfullname"
|
---|
171 | placeholder="Full name"
|
---|
172 | onkeydown="triggerSave()"
|
---|
173 | value="@Model.SelectedUser.FullName">
|
---|
174 | </div>
|
---|
175 | </div>
|
---|
176 | <div class="form-group">
|
---|
177 | <label for="inpemail"
|
---|
178 | class="col-sm-3 control-label">
|
---|
179 | Email
|
---|
180 | </label>
|
---|
181 | <div class="col-sm-8">
|
---|
182 | <input type="email"
|
---|
183 | class="form-control"
|
---|
184 | id="inpemail"
|
---|
185 | name="inpemail"
|
---|
186 | placeholder="Email"
|
---|
187 | onkeydown="triggerSave()"
|
---|
188 | value="@Model.SelectedUser.Email">
|
---|
189 | </div>
|
---|
190 | </div>
|
---|
191 | <input type="text"
|
---|
192 | style="display:none"
|
---|
193 | id="u"
|
---|
194 | name="u"
|
---|
195 | value="@Model.SelectedUser.Id" />
|
---|
196 | @if (Model.SelectedUser.Id != Guid.Empty)
|
---|
197 | {
|
---|
198 | <div class="form-group">
|
---|
199 | <label class="col-sm-3 control-label">
|
---|
200 | User id
|
---|
201 | </label>
|
---|
202 | <label class="col-sm-8 control-label" style="text-align:left">
|
---|
203 | @Model.SelectedUser.Id
|
---|
204 | </label>
|
---|
205 |
|
---|
206 | </div>
|
---|
207 | <div class="form-group">
|
---|
208 | <label class="col-sm-3 control-label">
|
---|
209 | User created
|
---|
210 | </label>
|
---|
211 | <label class="col-sm-8 control-label" style="text-align:left">
|
---|
212 | @Model.SelectedUser.CreationDate.AddHours(2).ToString();
|
---|
213 | </label>
|
---|
214 | </div>
|
---|
215 | <div class="form-group">
|
---|
216 | <label class="col-sm-3 control-label">
|
---|
217 | Last activity
|
---|
218 | </label>
|
---|
219 | <label class="col-sm-8 control-label" style="text-align:left">
|
---|
220 | @Model.SelectedUser.LastActivityDate.AddHours(2).ToString()
|
---|
221 | </label>
|
---|
222 | </div>
|
---|
223 | <div class="form-group">
|
---|
224 | <label class="col-sm-3 control-label">
|
---|
225 | Password
|
---|
226 | </label>
|
---|
227 | <div id="inppassreset" class="col-sm-8">
|
---|
228 | Last change: @Model.SelectedUser.LastPasswordChangedDate.ToShortDateString()
|
---|
229 | <button type="button"
|
---|
230 | onclick="resetPass('@(Model.SelectedUser.Id)')"
|
---|
231 | class="btn btn-default">
|
---|
232 | <i class="fa fa-unlock"></i> Reset password
|
---|
233 | </button>
|
---|
234 | </div>
|
---|
235 | </div>
|
---|
236 |
|
---|
237 | <div class="form-group">
|
---|
238 | <label class="col-sm-3 control-label">
|
---|
239 | Member of @Model.SelectedUserSubscriptions.Count groups
|
---|
240 | </label>
|
---|
241 | <div class="col-sm-8 control-label" style="text-align:left">
|
---|
242 | @if (Model.SelectedUserSubscriptions.Count > 0)
|
---|
243 | {
|
---|
244 | @foreach (var g in Model.SelectedUserSubscriptions)
|
---|
245 | {
|
---|
246 | <div class="row">
|
---|
247 | <p class="col-sm-10"><i class="fa fa-group"></i> @g.Name</p>
|
---|
248 | <p class="col-sm-2">
|
---|
249 | <a class="btn btn-danger pull-right"
|
---|
250 | asp-controller="User"
|
---|
251 | asp-action="deleteUserGroup"
|
---|
252 | asp-route-id="@Model.SelectedUser.Id"
|
---|
253 | asp-route-group="@g.Id"
|
---|
254 | onclick="showDeleter()">
|
---|
255 | <i class="fa fa-trash-o"></i>
|
---|
256 | </a>
|
---|
257 | </p>
|
---|
258 | </div>
|
---|
259 | }
|
---|
260 | }
|
---|
261 | else
|
---|
262 | {
|
---|
263 | <p>Not a member of any groups</p>
|
---|
264 | }
|
---|
265 | </div>
|
---|
266 | </div>
|
---|
267 | }
|
---|
268 |
|
---|
269 | <div class="row" style="margin-left:10px;margin-right:10px;margin-top:-10px">
|
---|
270 | <a class="btn btn-primary col-sm-3"
|
---|
271 | data-toggle="collapse"
|
---|
272 | href="#addgroups"
|
---|
273 | aria-expanded="false"
|
---|
274 | aria-controls="addgroups"
|
---|
275 | style="margin:10px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
276 | text-shadow:2px 2px black;">
|
---|
277 | @(Model.SelectedUser.Id == Guid.Empty ? "Set groups" : "Add groups")
|
---|
278 | </a>
|
---|
279 | <div class="collapse col-sm-12"
|
---|
280 | id="addgroups">
|
---|
281 | <div class="panel panel-primary" style="padding:0px">
|
---|
282 | <div class="panel-heading">
|
---|
283 | <p>
|
---|
284 | <i class="fa fa-group"></i> Groups
|
---|
285 | </p>
|
---|
286 | </div>
|
---|
287 | <div class="panel-body">
|
---|
288 | @foreach (var group in Model.ugroups)
|
---|
289 | {
|
---|
290 | <div class="checkbox">
|
---|
291 | <label>
|
---|
292 | <input type="checkbox"
|
---|
293 | name="groupstoadd"
|
---|
294 | @(Model.SelectedUserSubscriptions.Contains(group) ? "checked disabled" : "")
|
---|
295 | value="@group.Id"
|
---|
296 | onclick="triggerSave()">
|
---|
297 | @group.Name
|
---|
298 | </label>
|
---|
299 | </div>
|
---|
300 |
|
---|
301 | }
|
---|
302 | </div>
|
---|
303 | </div>
|
---|
304 | </div>
|
---|
305 | </div>
|
---|
306 |
|
---|
307 | @if (Model.SelectedUser.Id != Guid.Empty)
|
---|
308 | {
|
---|
309 | <div class="form-group">
|
---|
310 | <label class="col-sm-3 control-label">
|
---|
311 | @Model.SelectedUserRoles.Count Roles <br />
|
---|
312 | <span>
|
---|
313 | @if (Model.SelectedUserRoles.Where(x => x.Name == "Hive User").Count() != 0)
|
---|
314 | {
|
---|
315 | <span style="color:forestgreen">Job management<br /></span>
|
---|
316 | if (Model.SelectedUserRoles.Where(x => x.Name == "AccessService Administrator").Count() != 0)
|
---|
317 | {
|
---|
318 | <span style="color:forestgreen">User management<br /></span>
|
---|
319 | if (Model.SelectedUserRoles.Where(x => x.Name == "Hive Administrator").Count() != 0)
|
---|
320 | {
|
---|
321 | <span style="color:forestgreen">Resources<br /></span>
|
---|
322 |
|
---|
323 | }
|
---|
324 | }
|
---|
325 |
|
---|
326 |
|
---|
327 | }
|
---|
328 | else
|
---|
329 | {
|
---|
330 | <span style="color:darkred">No access to Hive<br /></span>
|
---|
331 |
|
---|
332 | }
|
---|
333 | @if (Model.SelectedUserRoles.Where(x => x.Name == "OKB User").Count() != 0)
|
---|
334 | {
|
---|
335 | <span style="color:forestgreen">OKB Query<br /></span>
|
---|
336 | if (Model.SelectedUserRoles.Where(x => x.Name == "OKB Administrator").Count() != 0)
|
---|
337 | {
|
---|
338 | <span style="color:forestgreen">OKB management<br /></span>
|
---|
339 |
|
---|
340 | }
|
---|
341 | }
|
---|
342 | else
|
---|
343 | {
|
---|
344 | <span style="color:darkred">No access to OKB<br /></span>
|
---|
345 |
|
---|
346 | }
|
---|
347 | </span>
|
---|
348 | </label>
|
---|
349 |
|
---|
350 | <div class="col-sm-8 control-label" style="text-align:left">
|
---|
351 | @if (Model.SelectedUserRoles.Count > 0)
|
---|
352 | {
|
---|
353 | @foreach (var r in Model.SelectedUserRoles)
|
---|
354 | {
|
---|
355 | <div class="row">
|
---|
356 |
|
---|
357 | <p class="col-sm-10"><i class="fa fa-gavel"></i> @r.Name</p>
|
---|
358 | <p class="col-sm-2">
|
---|
359 | <a class="btn btn-danger pull-right"
|
---|
360 | asp-controller="User"
|
---|
361 | asp-action="deleteUserRole"
|
---|
362 | asp-route-id="@Model.SelectedUser.Id"
|
---|
363 | asp-route-role="@r.Name"
|
---|
364 | onclick="showDeleter()">
|
---|
365 | <i class="fa fa-trash-o"></i>
|
---|
366 | </a>
|
---|
367 | </p>
|
---|
368 | </div>
|
---|
369 | }
|
---|
370 | }
|
---|
371 | else
|
---|
372 | {
|
---|
373 | <p>User has no roles</p>
|
---|
374 | }
|
---|
375 | </div>
|
---|
376 | </div>
|
---|
377 | }
|
---|
378 | <div class="row" style="margin-left:10px;margin-right:10px;">
|
---|
379 | <a class="btn btn-primary col-sm-3"
|
---|
380 | data-toggle="collapse"
|
---|
381 | href="#addroles"
|
---|
382 | aria-expanded="false"
|
---|
383 | aria-controls="addroles"
|
---|
384 | style="margin:10px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
---|
385 | text-shadow:2px 2px black;">
|
---|
386 | @(Model.SelectedUser.Id == Guid.Empty ? "Set roles" : "Add roles")
|
---|
387 | </a>
|
---|
388 | <div class="collapse col-sm-12"
|
---|
389 | id="addroles">
|
---|
390 | <div class="panel panel-primary" style="padding:0px">
|
---|
391 | <div class="panel-heading">
|
---|
392 | <p>
|
---|
393 | <i class="fa fa-gavel"></i> Roles
|
---|
394 | </p>
|
---|
395 | </div>
|
---|
396 | <div class="panel-body">
|
---|
397 | @foreach (var role in Model.roles)
|
---|
398 | {
|
---|
399 | <div class="checkbox">
|
---|
400 | <label>
|
---|
401 | <input type="checkbox"
|
---|
402 | name="rolestoadd"
|
---|
403 | @(Model.SelectedUserRoles.Contains(role) ? "checked disabled" : "")
|
---|
404 | value="@role.Name"
|
---|
405 | onclick="triggerSave()">
|
---|
406 | @role.Name
|
---|
407 | <span style="color:forestgreen">
|
---|
408 | @(role.Name == "Hive User" ? " (access to Hive and job manager)" : "")
|
---|
409 | @(role.Name == "Hive Administrator" ? " (access to resources)" : "")
|
---|
410 | @(role.Name == "AccessService Administrator" ? " (access to user manager)" : "")
|
---|
411 | @(role.Name == "OKB User" ? " (access to OKB Query)" : "")
|
---|
412 | @(role.Name == "OKB Administrator" ? " (access to OKB manager)" : "")
|
---|
413 | </span>
|
---|
414 | </label>
|
---|
415 | </div>
|
---|
416 |
|
---|
417 | }
|
---|
418 | </div>
|
---|
419 | </div>
|
---|
420 | </div>
|
---|
421 | </div>
|
---|
422 | <div class="form-group">
|
---|
423 | <div class="col-sm-offset-3 col-sm-3">
|
---|
424 | <button type="submit"
|
---|
425 | id="inpsaver"
|
---|
426 | disabled
|
---|
427 | class="btn btn-default">
|
---|
428 | <i class="fa fa-save"></i>
|
---|
429 | @(Model.SelectedUser.Id != Guid.Empty ? "Save changes" : "Add user")
|
---|
430 | </button>
|
---|
431 | </div>
|
---|
432 | @if (Model.SelectedUser.Id != Guid.Empty)
|
---|
433 | {
|
---|
434 | <div class="col-sm-5">
|
---|
435 | <a class="btn btn-danger pull-right"
|
---|
436 | asp-controller="User"
|
---|
437 | asp-action="deleteUser"
|
---|
438 | asp-route-id="@Model.SelectedUser.Id"
|
---|
439 | onclick="showDeleter()">
|
---|
440 | <i class="fa fa-trash-o"></i> Delete user
|
---|
441 | </a>
|
---|
442 | </div>
|
---|
443 | }
|
---|
444 | </div>
|
---|
445 |
|
---|
446 |
|
---|
447 |
|
---|
448 |
|
---|
449 | <script type="text/javascript">
|
---|
450 | function triggerSave() {
|
---|
451 | if ($("#inpfullname").val() != "" &&
|
---|
452 | $("#inpemail").val() != "") {
|
---|
453 | document.getElementById("inpsaver").className = "btn btn-lg btn-success";
|
---|
454 | document.getElementById("inpsaver").disabled = false;
|
---|
455 | }
|
---|
456 | else {
|
---|
457 | document.getElementById("inpsaver").className = "btn btn-default";
|
---|
458 | document.getElementById("inpsaver").disabled = true;
|
---|
459 |
|
---|
460 | }
|
---|
461 |
|
---|
462 | }
|
---|
463 | </script>
|
---|
464 | </form>
|
---|
465 |
|
---|
466 | </div>
|
---|
467 |
|
---|
468 | </div>
|
---|
469 |
|
---|
470 |
|
---|
471 |
|
---|
472 |
|
---|
473 |
|
---|
474 | </div>
|
---|
475 | }
|
---|
476 | </div>
|
---|
477 |
|
---|
478 | <script src="~/js/hubs/userinfohubber.js"></script>
|
---|
479 | <script type="text/javascript">
|
---|
480 | function showSaver() {
|
---|
481 | document.getElementById("content").style.display = "none";
|
---|
482 | document.getElementById("saver").style.display = "";
|
---|
483 |
|
---|
484 | }
|
---|
485 | function showUser() {
|
---|
486 | document.getElementById("content").style.display = "none";
|
---|
487 | document.getElementById("user").style.display = "";
|
---|
488 |
|
---|
489 | }
|
---|
490 | function showDeleter() {
|
---|
491 | document.getElementById("content").style.display = "none";
|
---|
492 | document.getElementById("deleter").style.display = "";
|
---|
493 | }
|
---|
494 | </script>
|
---|
495 | </div>
|
---|