v1.0 Initial commit of project
This commit is contained in:
122
pub/bin/pages/system/pageAccessControl_admin_add.php
Normal file
122
pub/bin/pages/system/pageAccessControl_admin_add.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
use api\classes\API;
|
||||
use bin\php\Classes\formBuilder;
|
||||
use bin\php\Classes\pageNavbar;
|
||||
|
||||
if (!defined('APP_INIT')) {
|
||||
exit;
|
||||
}
|
||||
# IDE Section
|
||||
|
||||
|
||||
# Includes Section
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/formBuilder.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/bin/php/Classes/pageNavbar.php');
|
||||
include_once($_SERVER['DOCUMENT_ROOT'] . '/api/classes/API.php');
|
||||
|
||||
# Check permissions
|
||||
$API = new API();
|
||||
if (!$API->checkPermissions('admin-access-admins', 'RW', true)) {
|
||||
echo 'error 401 unauthorized';
|
||||
exit;
|
||||
}
|
||||
# Page functions
|
||||
|
||||
# JS Scripts to load for this page
|
||||
$jsScriptLoadData['form'] = true;
|
||||
$jsScriptLoadData['Generatepassword'] = true;
|
||||
$jsScriptLoadData['passwordGenOnLoad'] = true;
|
||||
$jsScriptLoadData['passwordShowHide'] = true;
|
||||
$jsScriptLoadData['passwordRegen'] = true;
|
||||
$jsScriptLoadData['breadCrumbs'] = true;
|
||||
|
||||
# PageClasses Setup
|
||||
$pageNavbar = new pageNavbar(true);
|
||||
$pageNavbar->AddHTMLButton('<button class="btn btn-danger mx-3" type="button" disabled><i class="fas fa-trash-alt"></i>' . __('delete') . '</button>');
|
||||
$pageNavbar->AddHTMLButton('<a href="?admin_add="><button class="btn btn-primary"><i class="fas fa-plus text-success"></i>' . __('add_admin') . '</button></a>');
|
||||
$formBuilder = new formBuilder('add_admin', '<i class="fas fa-plus"></i>', '/accesscontrol/#user-groups');
|
||||
|
||||
# Retrieve Information for the page
|
||||
$user_groups_data = $GLOBALS['conn']->query("SELECT * FROM vc_user_groups WHERE user_group_type = 'admin' ORDER BY user_group_weight DESC");
|
||||
$user_groups = array();
|
||||
while ($user_group = $user_groups_data->fetch_assoc()) {
|
||||
array_push($user_groups, $user_group);
|
||||
$last_weight = $user_group['user_group_weight'];
|
||||
}
|
||||
|
||||
# Set breadcrumb data
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('administrators'), 'href' => '/accesscontrol/#administrators'));
|
||||
array_push($GLOBALS['breadCrumbArray'], array('display' => __('add_admin'), 'href' => ''));
|
||||
|
||||
# Start page output
|
||||
$pageNavbar->outPutNavbar();
|
||||
$formBuilder->startForm();
|
||||
?>
|
||||
|
||||
<form id="FormValidation" enctype="multipart/form-data" method="POST" action="/api/v1/users/">
|
||||
<div class="card-body">
|
||||
<div class="col">
|
||||
<p><?php echo __('admin_creation_instruction') ?></p>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_group_uuid" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_group') ?></label>
|
||||
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<select id="user_group_uuid" name="user_group_uuid" class="form-control" required>
|
||||
<?php foreach ($user_groups as $user_group) {
|
||||
if ($user_group['user_group_weight'] >= $_SESSION['user']['user_group_weight']) { ?>
|
||||
<option value="<?php echo $user_group['user_group_uuid'] ?>"><?php echo $user_group['user_group_name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
<!-- Options should be dynamically generated from the database -->
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_email" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_email') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="email" class="form-control" id="user_email" name="user_email" placeholder="user@example.xxx" required autofill="off" autofocus autocomplete="off"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_first_name" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('first_name') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="text" class="form-control" id="user_first_name" name="user_first_name" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Last Name -->
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_last_name" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('last_name') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="text" class="form-control" id="user_last_name" name="user_last_name" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Phone Number -->
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_phone_number" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('phone_number') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<input type="text" class="form-control" id="user_phone_number" name="user_phone_number" placeholder="+1234542069"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- User Status -->
|
||||
<div class="form-group form-show-validation row">
|
||||
<label for="user_status" class="col-lg-3 col-md-3 col-sm-4 mt-sm-2"><?php echo __('user_status') ?></label>
|
||||
<div class="col-lg-9 col-md-12 col-sm-10">
|
||||
<select id="user_status" name="user_status" class="form-control" required>
|
||||
<option value="inactive"><?php echo __('inactive') ?></option>
|
||||
<option value="banned"><?php echo __('banned') ?></option>
|
||||
<option value="pending" selected><?php echo __('pending') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php $formBuilder->formFooter(); ?>
|
||||
</form>
|
||||
<?php $formBuilder->endForm(); ?>
|
||||
Reference in New Issue
Block a user