Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html xmlns:th="http://www.thymeleaf.org">
- <head>
- <meta name="_csrf" th:content="${_csrf.token}"/>
- <meta name="_csrf_header" th:content="${_csrf.headerName}"/>
- <link rel="stylesheet" href="css/logowanie.css"/>
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <script src="https://rawgit.com/makeusabrew/bootbox/f3a04a57877cab071738de558581fbc91812dce9/bootbox.js"></script>
- <title>Przekazywanie uprawnień</title>
- </head>
- <body >
- <div class="container dashboard">
- <h2>Moduł przekazywania uprawnień</h2>
- <h4 th:text="'Aktywny użytkownik: '+${username}"/>
- <h5 th:if="${userPrivileges.getTake()}" style="text-align: right;">Ma prawo przejmij</h5>
- <h4>
- <form style="display: inline" action="/" method="get">
- <button type="submit" class="btn btn-md btn-primary">Zarządzaj danymi</button>
- </form>
- <form method="get" th:action="@{/adminview}" style="display: inline">
- <button type="submit" class="btn btn-md btn-primary">Zarządzaj uprawnieniami</button>
- </form>
- <form method="post" th:action="@{/logout}">
- <input type="hidden"
- th:name="${_csrf.parameterName}"
- th:value="${_csrf.token}"/>
- <button type="submit" class="btn btn-md btn-warning">Wyloguj</button>
- </form>
- </h4>
- <div class="panel panel-default main dashboard" style="padding-left: 12px; padding-top: 0px">
- <div th:if="${!userPrivileges.hasAnyGrantRight()}">
- <h4 style="text-align: center">Nie masz żadnego prawa, które mógłbyś przekazać!</h4>
- </div>
- <div th:if="${userPrivileges.hasAnyGrantRight()}">
- <div class="row space-for-div">
- <div class="col-md-4"></div>
- <div class="col-md-4">
- <h4 style="color: green" th:if="${successfullyGranted}">Przekazano poprawnie uprawnienia</h4>
- <h4 style="color: green" th:if="${successfullyModify}">Zmodyfikowano poprawnie uprawnienia</h4>
- <h4 style="color: green" th:if="${successfullyGift}">Oddano poprawnie uprawnienia</h4>
- <h4 style="color: red" th:if="${failedGranted}">Nie można przekazać takiego uprawnienia</h4>
- <h4 style="color: red" th:if="${noGrants}">Nie wybrano żadnych uprawnień</h4>
- </div>
- <div class="col-md-4"></div>
- </div>
- <form th:action="@{'/privilege/process'}"
- th:object="${sentPrivilege}"
- th:method="post"
- th:id="createForm">
- <div class="row space-for-div">
- <div class="col-md-7">
- <div class="divTable" th:with=" privilegesList = ${privilegeInfo.getColumnNamesInHb()}">
- <div class="divTableHeading">
- <div class="divTableHead"
- th:text="Tabele"></div>
- <div class="divTableHead"
- th:each=" privilege: ${privilegesList}"
- th:text=" ${T(org.springframework.util.StringUtils).capitalize(privilege)}"
- th:if="${privilege} != 'id'">
- </div>
- </div>
- <div class="divTableBody">
- <div class="divTableRow"
- th:with=" capitalizeTableHbName= ${T(org.springframework.util.StringUtils).capitalize(tableName.getValue())},
- grantRights=${'userPrivileges.get'+ capitalizeTableHbName +'().hasAnyGrantRight()'}"
- th:each="tableName : ${grantedPrivilegeInfo.getColumnNamesDbHbMap()}"
- th:if="${tableName.getKey()} != 'Dawca' and ${tableName.getKey()} != 'Przejmij'"
- th:field="*{__${tableName.getValue()}__}">
- <div class="divTableName" th:text="${tableName.getKey()}"
- th:style="${__${grantRights}__} == false ?'display:none':''"></div>
- <div class="divPrivilege" th:each="privilege: ${privilegesList}"
- th:style="${__${grantRights}__} == false ?'display:none':''"
- th:if="${privilege} != 'id'"
- th:with="capitalizedPrivilegeName= ${T(org.springframework.util.StringUtils).capitalize(privilege)},
- getterName=${'userPrivileges.get'+ capitalizeTableHbName +'().get'+capitalizedPrivilegeName+'()'}">
- <select class=" list yellow rounded"
- th:field="*{__${tableName.getValue() + '.' + privilege}__}">
- <option style="color:gray" th:selected="true"
- th:if="${__${getterName}__} == 'NONE' or ${__${getterName}__} == 'ACCESS'"
- value="NONE">Brak praw
- </option>
- <option th:if="${grantMode} == 'update' or ${grantMode} == 'create' and ${__${getterName}__} == 'GRANT'"
- value="NONE">
- Nie nadawaj
- </option>
- <option th:if="${grantMode} != 'update' and ${grantMode} != 'create' and ${__${getterName}__} == 'GRANT'"
- value="NONE">Nie
- przekazuj
- </option>
- <option th:if="${__${getterName}__} == 'GRANT'" value="ACCESS">Bez
- delegacji
- </option>
- <option th:if="${__${getterName}__} == 'GRANT'" value="GRANT">Z
- delegacją
- </option>
- </select>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="col-lg-1"></div>
- <div class="col-md-3">
- <h5>Wybierz użytkownika</h5>
- <select id="userSelect" class=" list yellow rounded" th:field="*{receiverName}"
- required="required">
- <option th:each="user : ${users}" th:value="${user}" th:text="${user}"></option>
- </select>
- <div th:if="${userPrivileges.getGrantPrivilegePK() != null and userPrivileges.getGrantPrivilegePK().isAdmin()}">
- <h5>Nadaj prawo przejmij</h5>
- <select class=" list yellow rounded" th:field="*{take}">
- <option th:selected="true" th:value="false">Nie</option>
- <option th:value="true">Tak</option>
- </select>
- <href/>
- </div>
- </div>
- <div class="col-lg-1"></div>
- </div>
- <div class="row space-for-div">
- <div class="col-md-9"></div>
- <div class="col-md-2">
- <button id="sendPrivilegeButton" type="submit" th:form="createForm"
- class="btn btn-sq btn-block btn-space btn-info" th:text="Wyślij">
- </button>
- </div>
- </div>
- <input type="hidden" name="grantMode" th:value="${grantMode}"/>
- </form>
- </div>
- </div>
- </div>
- <script th:inline="javascript">
- /*<![CDATA[*/
- function changeGrantMode(mode) {
- var token = $("meta[name='_csrf']").attr("content");
- //$('body').load("/offering?grantMode=" + mode);
- $.ajax({
- url: "/offering?grantMode=" + mode,
- headers: {'X-CSRF-TOKEN': token},
- type: "GET"
- }).done(function (data) {
- $('body').html(data);
- });
- }
- $('#sendPrivilegeButton').click(function (event) {
- event.preventDefault();
- var user = $('#userSelect').find(":selected").text();
- var token = $("meta[name='_csrf']").attr("content");
- //$('body').load("/offering?grantMode=" + mode);
- $.ajax({
- url: "/privilege/checkTake?username=" + user,
- headers: {'X-CSRF-TOKEN': token},
- type: "GET",
- async: false,
- success: function (data) {
- if (data == true) {
- bootbox.confirm({
- message: "<p style='font-size: 22px'>Stracisz wszystkie swoje prawa - użytkownik ma prawo przejmij!</p>",
- size: "large",
- callback: function (result) {
- if (result) $("#createForm").submit();
- },
- buttons: {
- confirm: {
- label: 'Potwierdź',
- className: 'btn-success',
- },
- cancel: {
- label: 'Rezygnuj',
- className: 'btn-danger'
- }
- }
- });
- }
- else $("#createForm").submit();
- },
- }).done(function (data) {
- });
- });
- function process() {
- return true;
- }
- /*]]>*/
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement