123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- <#import "template.ftl" as layout>
- <@layout.mainLayout active='authorization' bodyClass='authorization'; section>
- <style>
- .search-box,.close-icon,.search-wrapper {
- position: relative;
- }
- .search-wrapper {
- width: 500px;
- margin: auto;
- margin-top: 50px;
- }
- .search-box {
- font-weight: 600;
- color: white;
- border: 1px solid #006e9c;
- outline: 0;
- border-radius: 15px;
- background-color: #0085cf;
- padding: 2px 5px;
- }
- .search-box:focus {
- box-shadow: 0 0 15px 5px #b0e0ee;
- border: 2px solid #bebede;
- }
- .close-icon {
- border:1px solid transparent;
- background-color: transparent;
- display: inline-block;
- float: right;
- outline: 0;
- cursor: pointer;
- }
- .close-icon:after {
- display: block;
- width: 15px;
- height: 15px;
- background-color: #FA9595;
- z-index:1;
- right: 35px;
- top: 0;
- bottom: 0;
- margin: auto;
- padding: 2px;
- border-radius: 50%;
- text-align: center;
- color: white;
- font-weight: normal;
- font-size: 12px;
- box-shadow: 0 0 2px #E50F0F;
- cursor: pointer;
- }
- .search-box:not(:valid) ~ .close-icon {
- display: none;
- }
- </style>
- <script>
- function showHideActions(elm) {
- if (elm.style.display == 'none') {
- elm.style.display = '';
- } else {
- elm.style.display = 'none';
- }
- }
- function removeScopeElm(elm) {
- var td = elm.parentNode;
- var tr = td.parentNode;
- var tbody = tr.parentNode;
- td.removeChild(elm);
- var childCount = td.childNodes.length - 1;
- for (i = 0; i < td.childNodes.length; i++) {
- if (!td.childNodes[i].tagName || td.childNodes[i].tagName.toUpperCase() != 'DIV') {
- td.removeChild(td.childNodes[i]);
- childCount--;
- }
- }
- if (childCount <= 0) {
- tbody.removeChild(tr);
- }
- }
- function removeAllScopes(id) {
- var scopesElm = document.getElementsByName('removeScope-' + id);
- for (i = 0; i < scopesElm.length; i++) {
- var td = scopesElm[i].parentNode.parentNode;
- var tr = td.parentNode;
- var tbody = tr.parentNode;
- tbody.removeChild(tr);
- }
- }
- function selectAllCheckBoxes(formName, elm, name) {
- var shares = document.forms[formName].getElementsByTagName('input');
- for (i = 0; i < shares.length; i++) {
- if (shares[i].name == name) {
- shares[i].checked = elm.checked;
- }
- }
- }
- </script>
- <div class="row">
- <div class="col-md-10">
- <h2>
- ${msg("myResources")}
- </h2>
- </div>
- </div>
- <#if authorization.resourcesWaitingApproval?size != 0>
- <div class="row">
- <div class="col-md-12">
- <h3>
- ${msg("needMyApproval")}
- </h3>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <table class="table table-striped table-bordered">
- <thead>
- <tr>
- <th>${msg("resource")}</th>
- <th>${msg("requestor")}</th>
- <th>${msg("permissionRequestion")}</th>
- <th>${msg("action")}</th>
- </tr>
- </thead>
- <tbody>
- <#list authorization.resourcesWaitingApproval as resource>
- <#list resource.permissions as permission>
- <form action="${url.getResourceGrant(resource.id)}" name="approveForm-${resource.id}-${permission.requester.username}" method="post">
- <input type="hidden" name="action" value="grant">
- <input type="hidden" name="requester" value="${permission.requester.username}">
- <input type="hidden" id="stateChecker" name="stateChecker" value="${stateChecker}">
- <tr>
- <td>
- <#if resource.displayName??>${resource.displayName}<#else>${resource.name}</#if>
- </td>
- <td>
- <#if permission.requester.email??>${permission.requester.email}<#else>${permission.requester.username}</#if>
- </td>
- <td>
- <#list permission.scopes as scope>
- <#if scope.scope??>
- <div class="search-box">
- <#if scope.scope.displayName??>
- ${scope.scope.displayName}
- <#else>
- ${scope.scope.name}
- </#if>
- <button class="close-icon" type="button" id="grant-remove-scope-${resource.name}-${permission.requester.username}-${scope.scope.name}" name="removeScope-${resource.id}-${permission.requester.username}" onclick="removeScopeElm(this.parentNode);document.forms['approveForm-${resource.id}-${permission.requester.username}']['action'].value = 'deny';document.forms['approveForm-${resource.id}-${permission.requester.username}'].submit();"><i class="fa fa-times" aria-hidden="true"></i></button>
- <input type="hidden" name="permission_id" value="${scope.id}"/>
- </div>
- <#else>
- ${msg("anyPermission")}
- </#if>
- </#list>
- </td>
- <td width="20%" align="middle" style="vertical-align: middle">
- <a href="#" id="grant-${resource.name}-${permission.requester.username}" onclick="document.forms['approveForm-${resource.id}-${permission.requester.username}']['action'].value = 'grant';document.forms['approveForm-${resource.id}-${permission.requester.username}'].submit();" type="submit" class="btn btn-primary">${msg("doApprove")}</a>
- <a href="#" id="deny-${resource.name}-${permission.requester.username}" onclick="removeAllScopes('${resource.id}-${permission.requester.username}');document.forms['approveForm-${resource.id}-${permission.requester.username}']['action'].value = 'deny';document.forms['approveForm-${resource.id}-${permission.requester.username}'].submit();" type="submit" class="btn btn-danger">${msg("doDeny")}</a>
- </td>
- </tr>
- </form>
- </#list>
- </#list>
- </tbody>
- </table>
- </div>
- </div>
- </#if>
- <div class="row">
- <div class="col-md-12">
- <h3>
- ${msg("myResourcesSub")}
- </h3>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <table class="table table-striped table-bordered">
- <thead>
- <tr>
- <th>${msg("resource")}</th>
- <th>${msg("application")}</th>
- <th>${msg("peopleSharingThisResource")}</th>
- </tr>
- </thead>
- <tbody>
- <#if authorization.resources?size != 0>
- <#list authorization.resources as resource>
- <tr>
- <td>
- <a id="detail-${resource.name}" href="${url.getResourceDetailUrl(resource.id)}">
- <#if resource.displayName??>${resource.displayName}<#else>${resource.name}</#if>
- </a>
- </td>
- <td>
- <#if resource.resourceServer.baseUri??>
- <a href="${resource.resourceServer.baseUri}">${resource.resourceServer.name}</a>
- <#else>
- ${resource.resourceServer.name}
- </#if>
- </td>
- <td>
- <#if resource.shares?size != 0>
- <a href="${url.getResourceDetailUrl(resource.id)}">${resource.shares?size} <i class="fa fa-users"></i></a>
- <#else>
- ${msg("notBeingShared")}
- </#if>
- </td>
- </tr>
- </#list>
- <#else>
- <tr>
- <td colspan="4">${msg("notHaveAnyResource")}</td>
- </tr>
- </#if>
- </tbody>
- </table>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <h3>
- ${msg("resourcesSharedWithMe")}
- </h3>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <form action="${url.resourceUrl}" name="shareForm" method="post">
- <input type="hidden" name="action" value="cancel"/>
- <input type="hidden" id="stateChecker" name="stateChecker" value="${stateChecker}">
- <table class="table table-striped table-bordered">
- <thead>
- <tr>
- <th width="5%"><input type="checkbox" onclick="selectAllCheckBoxes('shareForm', this, 'resource_id');" <#if authorization.sharedResources?size == 0>disabled="true"</#if></td>
- <th>${msg("resource")}</th>
- <th>${msg("owner")}</th>
- <th>${msg("application")}</th>
- <th>${msg("permission")}</th>
- <th>${msg("date")}</th>
- </tr>
- </thead>
- <tbody>
- <#if authorization.sharedResources?size != 0>
- <#list authorization.sharedResources as resource>
- <tr>
- <td>
- <input type="checkbox" name="resource_id" value="${resource.id}"/>
- </td>
- <td>
- <#if resource.displayName??>${resource.displayName}<#else>${resource.name}</#if>
- </td>
- <td>
- ${resource.ownerName}
- </td>
- <td>
- <#if resource.resourceServer.baseUri??>
- <a href="${resource.resourceServer.baseUri}">${resource.resourceServer.name}</a>
- <#else>
- ${resource.resourceServer.name}
- </#if>
- </td>
- <td>
- <#if resource.permissions?size != 0>
- <ul>
- <#list resource.permissions as permission>
- <#list permission.scopes as scope>
- <#if scope.granted && scope.scope??>
- <li>
- <#if scope.scope.displayName??>
- ${scope.scope.displayName}
- <#else>
- ${scope.scope.name}
- </#if>
- </li>
- <#else>
- ${msg("anyPermission")}
- </#if>
- </#list>
- </#list>
- </ul>
- <#else>
- Any action
- </#if>
- </td>
- <td>
- ${resource.permissions[0].grantedDate?datetime}
- </td>
- </tr>
- </#list>
- <#else>
- <tr>
- <td colspan="6">${msg("noResourcesSharedWithYou")}</td>
- </tr>
- </#if>
- </tbody>
- </table>
- </form>
- </div>
- <#if authorization.sharedResources?size != 0>
- <div class="col-md-12">
- <a href="#" onclick="document.forms['shareForm'].submit();" type="submit" class="btn btn-danger">${msg("doRemoveSharing")}</a>
- </div>
- </#if>
- </div>
- <#if authorization.resourcesWaitingOthersApproval?size != 0>
- <br/>
- <div class="row">
- <div class="col-md-12">
- <h3>
- ${msg("requestsWaitingApproval")}
- </h3>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <i class="pficon pficon-info"></i> ${msg("havePermissionRequestsWaitingForApproval",authorization.resourcesWaitingOthersApproval?size)}
- <a href="#" onclick="document.getElementById('waitingApproval').style.display=''">${msg("clickHereForDetails")}</a>
- <div class="row">
- <div class="col-md-12"></div>
- </div>
- <div class="row">
- <div class="col-md-12"></div>
- </div>
- <div class="row">
- <div class="col-md-12"></div>
- </div>
- <div class="row" id="waitingApproval" style="display:none">
- <div class="col-md-12">
- <form action="${url.resourceUrl}" name="waitingApprovalForm" method="post">
- <input type="hidden" name="action" value="cancelRequest"/>
- <input type="hidden" id="stateChecker" name="stateChecker" value="${stateChecker}">
- <table class="table table-striped table-bordered">
- <thead>
- <tr>
- <th width="5%"><input type="checkbox" onclick="selectAllCheckBoxes('waitingApprovalForm', this, 'resource_id');" <#if authorization.resourcesWaitingOthersApproval?size == 0>disabled="true"</#if></th>
- <th>${msg("resource")}</th>
- <th>${msg("owner")}</th>
- <th>${msg("action")}</th>
- <th>${msg("date")}</th>
- </tr>
- </thead>
- <tbody>
- <#list authorization.resourcesWaitingOthersApproval as resource>
- <tr>
- <td>
- <input type="checkbox" name="resource_id" value="${resource.id}"/>
- </td>
- <td>
- <#if resource.displayName??>${resource.displayName}<#else>${resource.name}</#if>
- </td>
- <td>
- ${resource.ownerName}
- </td>
- <td>
- <ul>
- <#list resource.permissions as permission>
- <#list permission.scopes as scope>
- <li>
- <#if scope.scope??>
- <#if scope.scope.displayName??>
- ${scope.scope.displayName}
- <#else>
- ${scope.scope.name}
- </#if>
- <#else>
- ${msg("anyPermission")}
- </#if>
- </li>
- </#list>
- </#list>
- </ul>
- </td>
- <td>
- ${resource.permissions[0].createdDate?datetime}
- </td>
- </tr>
- </#list>
- </tbody>
- </table>
- </form>
- </div>
- <div class="col-md-12">
- <a href="#" onclick="document.forms['waitingApprovalForm'].submit();" type="submit" class="btn btn-danger">${msg("doRemoveRequest")}</a>
- </div>
- </div>
- </div>
- </div>
- </#if>
- </@layout.mainLayout>
|