Commit 904aac61 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

feat(auth): create group with object class definition

parent 9d0593bc
......@@ -2640,10 +2640,14 @@ sub new_group($c) {
my @error = ();
my $groupname = ($c->param('groupname') or '');
my $object_class = $c->every_param('object_class');
push @$object_class,('top' , 'groupOfUniqueNames');
if ($groupname) {
if ($groupname =~ /^[0-9a-zA-Z._-]+$/) {
eval {
Ravada::Auth::LDAP::add_group($groupname);
Ravada::Auth::LDAP::add_group($groupname,undef, $object_class);
};
push @error,($@) if $@;
} else {
......
......@@ -4,9 +4,14 @@
novalidate
>
<div class="from-group">
<label for="username"><%=l 'Group name' %></label><%= $groupname %>
<label for="groupname"><%=l 'Group name' %></label><%= $groupname %>
<input class="form-control" ng-model-onblur placeholder="<%=l 'Enter group name' %>" type="text" ng-maxlength="80" ng-minlength="5" name="groupname" ng-pattern="/^[a-zA-Z0-9_.-]*$/" id="groupname" required="" value="<%= $groupname %>"><br/>
</div>
</div>
<div class="form-group">
% for (sort ('nsMemberOf','posixGroup') ) {
<input type="checkbox" checked="true" name="object_class" value="<%= $_ %>"> <%= $_ %><br/>
% }
</div>
<div class="card-text" ng-show="new_userForm.$submitted || (new_userForm.groupname.$touched && new_userForm.groupname.$dirty)">
<div ng-show="new_userForm.groupname.$error.required" class="alert alert-warning">
<strong><%=l 'Oops!' %></strong>&nbsp;<%=l 'Group name is required' %>.
......
Markdown is supported
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