Commit 788127e6 authored by Fernando Verdugo's avatar Fernando Verdugo Committed by Francesc Guasch
Browse files

1098 access (#1113)

* fix(access): Add access tab
* fix(access): Improve appearance
* fix(access): Add i18n strings

Issue #1098
parent 243df982
......@@ -812,3 +812,60 @@ msgstr ""
msgid "Italian"
msgstr ""
msgid "Type a typical LDAP user name to fetch the attribute list"
msgstr ""
msgid "User name"
msgstr ""
msgid "not found in LDAP server"
msgstr ""
msgid "Attribute"
msgstr ""
msgid "Value"
msgstr ""
msgid "Allowed"
msgstr ""
msgid "Last"
msgstr ""
msgid "Default"
msgstr ""
msgid "If none of the previous match, access is allowed."
msgstr ""
msgid "If none of the previous match, access is denied."
msgstr ""
msgid "verify"
msgstr ""
msgid "save"
msgstr ""
msgid "Verifying"
msgstr ""
msgid "No entries found"
msgstr ""
msgid "has at least"
msgstr ""
msgid "entries."
msgstr ""
msgid "Enable last for not allowed restrictions."
msgstr ""
msgid ""
msgstr ""
msgid ""
msgstr ""
\ No newline at end of file
<div class="panel panel-default">
<div class="panel-body">
Type a typical LDAP user name to fetch the attribute list
<div class="card">
<div class="card-body">
<%=l 'Type a typical LDAP user name to fetch the attribute list' %>
<input type="text" ng-model="cn" ng-change="list_ldap_attributes()"
ng-init="cn='<%= $ldap_attributes_cn %>'">
<span ng-hide="ldap_attributes || !cn">
User name <b>{{cn}}</b> not found in LDAP server
</span>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-md-2">
<b>Attribute</b>
</div>
<div class="col-md-3">
<b>Value</b>
</div>
<div class="col-md-1">
<b>Allowed</b>
</div>
<div class="col-md-1">
<b>Last</b>
</div>
<div class="alert alert-danger d-inline-flex p-2" role="alert" ng-hide="ldap_attributes || !cn">
<%=l 'User name' %>&nbsp;<b>{{cn}}</b>&nbsp;<%=l 'not found in LDAP server' %>
</div>
</div><!-- of panel heading -->
<div class="panel-body">
%= include "/main/machine_access_list"
</div>
<div class="panel-footer">
<div class="card">
<table class="card-table table-striped">
<thead>
<tr>
<th class="col-lg-3" scope="col"><b><%=l 'Attribute' %></b></th>
<th class="col-lg-3" scope="col"><b><%=l 'Value' %></b></th>
<th class="col-lg-2" scope="col"><b><%=l 'Allowed' %></b></th>
<th class="col-lg-1" scope="col"><b><%=l 'Last' %></b></th>
<th class="col-lg-1" scope="col"></th>
<th class="col-lg-1" scope="col"></th>
<th class="col-lg-1" scope="col"></th>
</tr><!-- of card header -->
</thead>
<tbody>
%= include "/main/machine_access_list"
</tbody>
</table>
</div>
<div class="card-footer">
%= include "/main/machine_access_new"
</div>
</div>
<div class="row" ng-repeat="attribute in ldap_attributes_domain">
<div class="col-md-2">
<tr ng-repeat="attribute in ldap_attributes_domain">
<td class="col-lg-3">
{{attribute.attribute}}
</div>
<div class="col-md-3">
</td>
<td class="col-lg-3">
{{attribute.value}}
</div>
<div class="col-md-1">
</td>
<td class="col-lg-2">
<input type="checkbox" ng-checked="attribute.allowed"
ng-click="set_ldap_access(attribute.id, !attribute.allowed, attribute.last)"
>
</div>
<div class="col-md-1">
</td>
<td class="col-lg-1">
<input type="checkbox" ng-checked="attribute.last"
ng-disabled="!attribute.allowed"
ng-click="set_ldap_access(attribute.id, attribute.allowed, !attribute.last)"
>
</div>
<div class="col-md-1" ng-show="ldap_attributes_domain.length>1">
<button class="btn" ng-hide="$index == ldap_attributes_domain.length-1"
</td>
<td class="col-lg-3">
<button ng-show="ldap_attributes_domain.length>1" class="btn btn-outline-dark btn-sm" ng-hide="$index == ldap_attributes_domain.length-1" title="<%=l 'Down' %>"
ng-click="move_ldap_access(attribute.id, +1);"
><i class="fa fa-arrow-down"></i></button>
</div>
<div class="col-md-1" ng-show="ldap_attributes_domain.length>1">
<button class="btn" ng-show="$index" ng-click="move_ldap_access(attribute.id,-1)"
<button ng-show="ldap_attributes_domain.length>1" class="btn btn-outline-dark btn-sm" ng-show="$index" ng-click="move_ldap_access(attribute.id,-1)" title="<%=l 'Up' %>"
><i class="fa fa-arrow-up" ></i></button>
</div>
<div class="col-md-1">
<button class="btn"
ng-click="delete_ldap_access(attribute.id)"><i class="fas fa-times"></i></button>
</div>
</div>
<div class="row" ng-show="ldap_attributes_default.id">
<div class="col-md-2">
<i>Default</i>
</div>
<div class="col-md-3"></div>
<div class="col-md-1">
<button class="btn btn-outline-danger btn-sm"
ng-click="delete_ldap_access(attribute.id)" title="<%=l 'Remove' %>"><i class="fas fa-times"></i></button>
</td>
</tr>
<tr ng-show="ldap_attributes_default.id">
<td class="col-lg-3">
<i><%=l 'Default' %></i>
</td>
<td class="col-lg-3"></td>
<td class="col-lg-2" colspan="5">
<input type="checkbox"
ng-checked="ldap_attributes_default.allowed"
ng-click="set_ldap_access(ldap_attributes_default.id, !ldap_attributes_default.allowed)">
</div>
<div class="col-md-4">
<span ng-show="ldap_attributes_default.allowed">If none of the previous match,
access is allowed.</span>
<span ng-show="!ldap_attributes_default.allowed">If none of the previous match,
access is denied.</span>
</div>
</div>
<span ng-show="ldap_attributes_default.allowed"><%=l 'If none of the previous match, access is allowed.' %></span>
<span ng-show="!ldap_attributes_default.allowed"><%=l 'If none of the previous match, access is denied.' %></span>
</td>
</tr>
<div class="row">
<div class="col-md-2">
<select ng-model="ldap_attribute" ng-change="ldap_entries=0;ldap_verified=false">
<option ng-repeat="attribute in ldap_attributes" value="{{attribute}}">
{{attribute}}
</option>
</select>
</div>
<div class="col-md-3">
<input ng-model="ldap_attribute_value" type="text"
<div class="input-group col-lg-6">
<div class="input-group-prepend">
<select ng-model="ldap_attribute" ng-change="ldap_entries=0;ldap_verified=false">
<option ng-repeat="attribute in ldap_attributes" value="{{attribute}}">
{{attribute}}
</option>
</select>
</div>
<input class="col-lg-6" ng-model="ldap_attribute_value" type="text"
ng-change="ldap_entries=0;ldap_verified=false">
</div>
<div class="col-md-1">
<div class="col-lg-2">
<input ng-model="ldap_attribute_allowed" type="checkbox">
</div>
<div class="col-md-1">
<div class="col-lg-1">
<input ng-model="ldap_attribute_last" type="checkbox"
title="Finish checking permission when this matches"
>
</div>
<div class="col-md-2">
<button
<div class="col-lg-3">
<input type="button" class="btn btn-success"
ng-show="ldap_attribute && ldap_attribute_value"
ng-disabled="ldap_verifying"
ng-click="count_ldap_entries()"
>verify</button>
<button ng-show="ldap_attribute && ldap_attribute_value"
value="<%=l 'verify' %>">
<input type="button" class="btn btn-primary"
ng-show="ldap_attribute && ldap_attribute_value"
ng-disabled="ldap_verifying || (!ldap_attribute_allowed && ! ldap_attribute_last)"
ng-click="add_ldap_access()"
>save</button>
</div>
<div class="col-md-3">
<span ng-show="ldap_verifying">Verifying {{ldap_attribute}} ...</span>
<span ng-show="ldap_verified && !ldap_entries">No entries found</span>
<span ng-show="ldap_verified && ldap_entries">{{ldap_attribute}} = {{ldap_attribute_value}} has at least {{ldap_entries}} entries. </span>
<span ng-show="!ldap_attribute_allowed && !ldap_attribute_last">
Enable last for not allowed restrictions.
</span>
value="<%=l 'save' %>">
</div>
</div>
<div class="mt-3 alert alert-warning" role="alert"
ng-show="ldap_verifying"><%=l 'Verifying' %> {{ldap_attribute}} ...
</div>
<div class="mt-3 alert alert-danger" role="alert"
ng-show="ldap_verified && !ldap_entries"><%=l 'No entries found' %>
</div>
<div class="mt-3 alert alert-primary" role="alert"
ng-show="ldap_verified && ldap_entries">{{ldap_attribute}} = {{ldap_attribute_value}}
<%=l 'has at least' %> {{ldap_entries}} <%=l 'entries.' %>
</div>
<div class="mt-3 alert alert-primary" role="alert"
ng-show="!ldap_attribute_allowed && !ldap_attribute_last">
<%=l 'Enable last for not allowed restrictions.' %>
</div>
......@@ -63,8 +63,11 @@
%= include 'main/vm_ports'
</div>
% }
% if ( $USER->is_admin()) {
<div class="tab-pane fade" id="v-pills-access" role="tabpanel" aria-labelledby="v-pills-access-tab">
%= include 'main/machine_access'
</div>
% }
% if ( $USER->can_remove_machine($domain->id)) {
<div class="tab-pane fade" id="v-pills-remove" role="tabpanel" aria-labelledby="v-pills-remove-tab">
%= include 'main/vm_remove'
......
......@@ -29,10 +29,12 @@
% if ( $USER->can_expose_ports()) {
<a class="nav-link ports" id="v-pills-remove-tab" href="#v-pills-ports" data-toggle="pill" role="tab" aria-controls="v-pills-ports" aria-selected="false"><%=l 'Ports' %></a>
% }
% if ( $USER->is_admin()) {
<a class="nav-link access" id="v-pills-access-tab" href="#v-pills-access" data-toggle="pill" role="tab" aria-controls="v-pills-access" aria-selected="false"><%=l 'Access' %></a></li>
% }
% if ( $USER->can_remove_machine($domain->id)) {
<a class="nav-link remove" id="v-pills-remove-tab" ng-click="refresh_machine()" href="#v-pills-remove" data-toggle="pill" role="tab" aria-controls="v-pills-remove" aria-selected="false"><%=l 'Remove' %></a>
% }
% if ($USER->is_admin && $domain->is_base){
<a class="nav-link" id="v-pills-remove-tab" ng-click="refresh_machine()" href="#v-pills-clones" data-toggle="pill" role="tab" aria-controls="v-pills-clones" aria-selected="false"><%=l 'Clones' %></a>
% }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment