Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
55cd77a8
Unverified
Commit
55cd77a8
authored
Oct 05, 2021
by
JR
Committed by
GitHub
Oct 05, 2021
Browse files
issue #1588 (#1597)
Use ldapGroup component for select group access machine
parent
7aebffee
Changes
3
Show whitespace changes
Inline
Side-by-side
public/js/booking/ldapGroup.component.html
View file @
55cd77a8
<div>
<input
type=
"text"
ng-model=
"$ctrl.group_selected"
placeholder=
"
Escriu el
grup"
<input
type=
"text"
ng-model=
"$ctrl.group_selected"
placeholder=
"
Search
gr
o
up"
ng-if=
"$ctrl.editable"
ng-required=
"!$ctrl.ngModel.$valid"
uib-typeahead=
"name for name in $ctrl.getGroups($viewValue)"
...
...
public/js/booking/ldapGroups.component.js
View file @
55cd77a8
...
...
@@ -6,6 +6,8 @@ export default {
},
bindings
:
{
editable
:
'
<
'
,
onAdd
:
'
&
'
,
onDelete
:
'
&
'
},
templateUrl
:
'
/js/booking/ldapGroup.component.html
'
,
controller
:
grpCtrl
...
...
@@ -39,8 +41,12 @@ function grpCtrl(apiLDAP, $scope, $timeout) {
}
else
{
self
.
selected_groups
.
push
(
self
.
group_selected
);
}
self
.
onAdd
({
group
:
self
.
group_selected
})
self
.
group_selected
=
null
;
};
self
.
remove_ldap_group
=
group
=>
self
.
selected_groups
=
remove_array_element
(
self
.
selected_groups
,
group
);
self
.
remove_ldap_group
=
group
=>
{
self
.
selected_groups
=
remove_array_element
(
self
.
selected_groups
,
group
)
self
.
onDelete
({
group
})
}
}
templates/main/machine_access_group.html.ep
View file @
55cd77a8
<div class="card">
<div class="card-body">
<button ng-enabled="allow_group"
ng-click="add_group_access(allow_group)">Add</button>
<select ng-model="allow_group"
ng-show="ldap_groups"
ng-options="group for group in ldap_groups | orderBy:group"
>
</select>
<div ng-show="ldap_groups && !access_groups">
<div ng-show="ldap_groups && !access_groups">
<i class="fas fa-sync-alt fa-spin"></i>
</div>
</div>
<ldap-groups name="groups"
ng-model="access_groups" editable="true"
on-add="add_group_access(group)"
on-delete="remove_group_access(group)"
></ldap-groups>
<div class="card-body">
<div class="card-body">
<div class="alert alert-warning" ng-show="access_groups && access_groups.length == 0">
<div ng-show="ldap_groups && ldap_groups.length == 0 ">
<div class="alert alert-warning" ng-show="access_groups && access_groups.length ==
=
0">
<div ng-show="ldap_groups && ldap_groups.length ==
=
0 ">
<%=l 'There are no LDAP groups defined.' %>
% if ( $USER->is_admin ) {
<a href="/admin/groups">Create one.</a>
% }
</div>
<%=l 'This virtual machine has no group restrictions.' %>
</div>
</div>
<div ng-show="access_groups && access_groups.length > 0">
<div ng-show="access_groups && access_groups.length > 0">
<b><%=l 'Only users from these groups will be allowed to execute this machine' %></b>
</div>
<table ng-show="access_groups.length" class="card-table table-stripped">
<tbody>
<tr ng-repeat="group in access_groups">
<td>
<button ng-click="remove_group_access(group)"
class="badge badge-light text-blue">x</button>
<a ng-bind-html="group" href="/admin/group/{{group}}">{{group}}</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment