mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-07-07 20:43:44 +02:00
User App
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
{% load static %}
|
||||
<script src="{% static 'baseTemplate/angularjs.1.6.5.js' %}"></script>
|
||||
<script src="{% static 'baseTemplate/jquery.3.2.1.js' %}"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'baseTemplate/custom-js/pnotify.custom.min.css' %}">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -228,13 +229,13 @@
|
||||
Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
<a href="{% url 'createUserV2' %}"
|
||||
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
|
||||
Create
|
||||
New User</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
<a href="{% url 'listUsersV2' %}"
|
||||
class="flex items-center w-full text-base font-normal text-white transition duration-75 rounded-lg group hover:bg-cyan-400 dark:text-white dark:hover:bg-gray-700 pl-11">•
|
||||
List
|
||||
Users</a>
|
||||
@@ -1662,9 +1663,11 @@
|
||||
</div>
|
||||
|
||||
<!-- Connecting JS -->
|
||||
<script src="homepage.js"></script>
|
||||
{#<script src="homepage.js"></script>#}
|
||||
<script src="{% static 'baseTemplate/custom-js/pnotify.custom.min.js' %}"></script>
|
||||
<script src="{% static 'baseTemplate/newBase.js' %}"></script>
|
||||
<script src="{% static 'websiteFunctions/websiteFunctionsV2.js' %}"></script>
|
||||
<script src="{% static 'userManagment/userManagementV2.js' %}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
407
userManagment/static/userManagment/userManagementV2.js
Normal file
407
userManagment/static/userManagment/userManagementV2.js
Normal file
@@ -0,0 +1,407 @@
|
||||
newapp.controller('createUserCtrV2', function ($scope, $http) {
|
||||
|
||||
$scope.acctsLimit = true;
|
||||
$scope.webLimits = true;
|
||||
$scope.userCreated = true;
|
||||
$scope.userCreationFailed = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.userCreationLoading = true;
|
||||
$scope.combinedLength = true;
|
||||
|
||||
$scope.createUserFunc = function () {
|
||||
|
||||
$scope.webLimits = false;
|
||||
$scope.userCreated = true;
|
||||
$scope.userCreationFailed = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.userCreationLoading = false;
|
||||
$scope.combinedLength = true;
|
||||
|
||||
|
||||
var firstName = $scope.firstName;
|
||||
var lastName = $scope.lastName;
|
||||
var email = $scope.email;
|
||||
var selectedACL = $scope.selectedACL;
|
||||
var websitesLimits = $scope.websitesLimits;
|
||||
var userName = $scope.userName;
|
||||
var password = $scope.password;
|
||||
|
||||
|
||||
var url = "/users/submitUserCreation";
|
||||
|
||||
var data = {
|
||||
firstName: firstName,
|
||||
lastName: lastName,
|
||||
email: email,
|
||||
selectedACL: selectedACL,
|
||||
websitesLimit: websitesLimits,
|
||||
userName: userName,
|
||||
password: password,
|
||||
securityLevel: $scope.securityLevel
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if (response.data.createStatus == 1) {
|
||||
|
||||
$scope.userCreated = false;
|
||||
$scope.userCreationFailed = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.userCreationLoading = true;
|
||||
|
||||
$scope.userName = userName;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$scope.acctsLimit = false;
|
||||
$scope.webLimits = false;
|
||||
$scope.userCreated = true;
|
||||
$scope.userCreationFailed = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.userCreationLoading = true;
|
||||
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.acctsLimit = false;
|
||||
$scope.webLimits = false;
|
||||
$scope.userCreated = true;
|
||||
$scope.userCreationFailed = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.userCreationLoading = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.hideSomeThings = function () {
|
||||
|
||||
$scope.userCreated = true;
|
||||
|
||||
|
||||
};
|
||||
|
||||
///
|
||||
|
||||
$scope.generatedPasswordView = true;
|
||||
|
||||
$scope.generatePassword = function () {
|
||||
$scope.generatedPasswordView = false;
|
||||
$scope.password = randomPassword(16);
|
||||
};
|
||||
|
||||
$scope.usePassword = function () {
|
||||
$scope.generatedPasswordView = true;
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
newapp.controller('listTableUsersV2', function ($scope, $http) {
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
|
||||
var UserToDelete;
|
||||
|
||||
$scope.populateCurrentRecords = function () {
|
||||
$scope.cyberpanelLoading = false;
|
||||
|
||||
url = "/users/fetchTableUsers";
|
||||
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
|
||||
if (response.data.status === 1) {
|
||||
|
||||
$scope.records = JSON.parse(response.data.data);
|
||||
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Users successfully fetched!',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} else {
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: 'Could not connect to server, please refresh this page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
$scope.populateCurrentRecords();
|
||||
|
||||
|
||||
$scope.deleteUserInitial = function (name){
|
||||
UserToDelete = name;
|
||||
$scope.UserToDelete = name;
|
||||
};
|
||||
|
||||
$scope.deleteUserFinal = function () {
|
||||
$scope.cyberpanelLoading = false;
|
||||
|
||||
var url = "/users/submitUserDeletion";
|
||||
|
||||
var data = {
|
||||
accountUsername: UserToDelete,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
if (response.data.deleteStatus === 1) {
|
||||
$scope.populateCurrentRecords();
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Users successfully deleted!',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: 'Could not connect to server, please refresh this page.',
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.editInitial = function (name) {
|
||||
|
||||
$scope.name = name;
|
||||
|
||||
};
|
||||
|
||||
$scope.saveResellerChanges = function () {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
|
||||
url = "/users/saveResellerChanges";
|
||||
|
||||
var data = {
|
||||
userToBeModified: $scope.name,
|
||||
newOwner: $scope.newOwner
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.status === 1) {
|
||||
$scope.populateCurrentRecords();
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Changes successfully applied!',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} else {
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: response.data.errorMessage,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: 'Could not connect to server, please refresh this page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.changeACLFunc = function () {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
|
||||
url = "/users/changeACLFunc";
|
||||
|
||||
var data = {
|
||||
selectedUser: $scope.name,
|
||||
selectedACL: $scope.selectedACL
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
|
||||
if (response.data.status === 1) {
|
||||
$scope.populateCurrentRecords();
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'ACL Successfully changed.',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} else {
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: response.data.errorMessage,
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.aclLoading = true;
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: 'Could not connect to server, please refresh this page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
$scope.controlUserState = function (userName, state) {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
|
||||
var url = "/users/controlUserState";
|
||||
|
||||
var data = {
|
||||
accountUsername: userName,
|
||||
state: state
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
if (response.data.status === 1) {
|
||||
$scope.populateCurrentRecords();
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Action successfully started.',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
new PNotify({
|
||||
title: 'Error!',
|
||||
text: 'Could not connect to server, please refresh this page.',
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
153
userManagment/templates/userManagment/createUserV2.html
Normal file
153
userManagment/templates/userManagment/createUserV2.html
Normal file
@@ -0,0 +1,153 @@
|
||||
{% extends "baseTemplate/newBase.html" %}
|
||||
{% load i18n %}
|
||||
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
|
||||
{% block newContent %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
<div ng-controller="createUserCtrV2" class="p-8">
|
||||
<div>
|
||||
<p class="text-4xl font-bold">Create New User</p>
|
||||
<p class="text-xs text-gray-600 py-2 font-semibold">Create root, reseller or normal users on this page.</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="py-4">
|
||||
<p class="text-xl font-bold">User Details</p>
|
||||
<img ng-hide="userCreationLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
<div class="flex mt-4 py-2 px-6">
|
||||
<div>
|
||||
<p class="font-semibold w-60">First Name</p>
|
||||
</div>
|
||||
<div>
|
||||
<input name="firstName" ng-pattern="/^[a-zA-Z ]+$/" type="text"
|
||||
class="w-80 bg-gray-100 rounded px-2 py-1"
|
||||
ng-model="firstName" required>
|
||||
<div ng-show="createUser.firstName.$error.pattern"
|
||||
class="current-pack">{% trans "First Name should contain only alphabetic characters." %}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex py-2 px-6">
|
||||
<div>
|
||||
<p class="font-semibold w-60">Last Name</p>
|
||||
</div>
|
||||
<div>
|
||||
<input name="lastName" ng-pattern="/^[a-zA-Z ]+$/" type="text"
|
||||
class="w-80 bg-gray-100 rounded px-2 py-1"
|
||||
ng-model="lastName" required>
|
||||
<div ng-show="createUser.lastName.$error.pattern"
|
||||
class="current-pack">{% trans "Last Name should contain only alphabetic characters." %}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex py-2 px-6">
|
||||
<div>
|
||||
<p class="font-semibold w-60">Email</p>
|
||||
</div>
|
||||
<div>
|
||||
<input name="email" type="email" class="w-80 bg-gray-100 rounded px-2 py-1" ng-model="email"
|
||||
required>
|
||||
<div ng-show="createUser.email.$error.email"
|
||||
class="current-pack">{% trans "Invalid Email" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex py-2 px-6">
|
||||
<div>
|
||||
<p class="font-semibold w-60">Select ACL</p>
|
||||
</div>
|
||||
<div>
|
||||
<select ng-model="selectedACL" class="w-80 bg-gray-100 rounded px-2 py-1">
|
||||
{% for items in aclNames %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex py-2 px-6">
|
||||
<div>
|
||||
<p class="font-semibold w-60">Website Limit</p>
|
||||
</div>
|
||||
<div>
|
||||
<input name="websitesLimits" placeholder="0 = Unlimited" type="number"
|
||||
class="w-80 bg-gray-100 rounded px-2 py-1"
|
||||
ng-model="websitesLimits" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex py-2 px-6">
|
||||
<div>
|
||||
<p class="font-semibold w-60">Username</p>
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" class="w-80 bg-gray-100 rounded px-2 py-1" ng-model="userName" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex py-2 px-6">
|
||||
<div>
|
||||
<p class="font-semibold w-60">Password</p>
|
||||
</div>
|
||||
<div>
|
||||
<input name="password" type="password" class="w-80 bg-gray-100 rounded px-2 py-1"
|
||||
ng-model="password"
|
||||
required>
|
||||
</div>
|
||||
<div class="w-80 ml-4">
|
||||
<button ng-click="generatePassword()" class="bg-orange-500 text-white font-semibold px-2 py-1">
|
||||
Generate
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="generatedPasswordView" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Generated Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="email" class="form-control" ng-model="password" required>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<button type="button" ng-click="usePassword()"
|
||||
class="btn btn-primary">{% trans "Use" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex py-2 px-6">
|
||||
<div>
|
||||
<p class="font-semibold w-60">Security Level</p>
|
||||
</div>
|
||||
<div>
|
||||
<select ng-init="securityLevels={{ securityLevels }};securityLevel='HIGH'"
|
||||
ng-model="securityLevel" ng-options="s for s in securityLevels track by s"
|
||||
class="w-80 bg-gray-100 rounded px-2 py-1">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-center mt-6">
|
||||
<button ng-click="createUserFunc()" class="bg-orange-500 text-white font-bold px-4 py-2">
|
||||
Create User
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-6">
|
||||
<div ng-hide="userCreated" class="alert alert-success">
|
||||
<p>{% trans "Account with username:" %} <strong>{$ userName
|
||||
$}</strong> {% trans "is successfully created." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="userCreationFailed" class="alert alert-danger">
|
||||
<p>{% trans "Cannot create user. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="combinedLength" class="alert alert-danger">
|
||||
<p>{% trans "Length of first and last name combined should be less than or equal to 20 characters" %}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
78
userManagment/templates/userManagment/listUsersV2.html
Normal file
78
userManagment/templates/userManagment/listUsersV2.html
Normal file
@@ -0,0 +1,78 @@
|
||||
{% extends "baseTemplate/newBase.html" %}
|
||||
{% load i18n %}
|
||||
{% block titleNew %}{% trans "Home - CyberPanel" %}{% endblock %}
|
||||
{% block newContent %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
<div ng-controller="listTableUsersV2" class="p-8">
|
||||
<div class="flex lg:flex-row justify-between items-center sm:flex-col">
|
||||
<div>
|
||||
<p class="text-4xl font-bold">List Users</p>
|
||||
<p class="text-xs text-gray-600 py-2 font-semibold">List users that you own.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="py-4">
|
||||
<p class="text-xl font-bold">List Users</p>
|
||||
<img ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}">
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="py-8 overflow-x-auto">
|
||||
<div class="px-5">
|
||||
<table>
|
||||
<thead>
|
||||
<div>
|
||||
<tr>
|
||||
<th class="w-36 text-xl">Username</th>
|
||||
<th class="w-36 text-xl">Website Limit</th>
|
||||
<th class="w-36 text-xl">Disk Usage</th>
|
||||
<th class="w-28 text-xl">ACL</th>
|
||||
<th class="w-28 text-xl">Owner</th>
|
||||
<th class="w-28 text-xl">State</th>
|
||||
<th class="w-28 text-xl">Action</th>
|
||||
</tr>
|
||||
</div>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="rounded-lg px-3 mt-5">
|
||||
<div class="px-2" ng-repeat="record in records track by $index">
|
||||
<div class="border shadow-lg py-3 mb-3 rounded-b-lg">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="w-36 pt-2 font-semibold text-sm">
|
||||
<td ng-bind="record.name"></td>
|
||||
</th>
|
||||
<th class="w-36 pt-2 font-semibold text-sm flex justify-center">
|
||||
<td ng-bind="record.websites"></td>
|
||||
</th>
|
||||
<th class="w-36 pt-2 font-semibold text-sm">
|
||||
<td ng-bind="record.diskUsage"></td>
|
||||
</th>
|
||||
<th class="w-28 pt-2 font-semibold text-sm">
|
||||
<td ng-bind="record.acl"></td>
|
||||
</th>
|
||||
<th class="w-28 pt-2 font-semibold text-sm">
|
||||
<td ng-bind="record.owner"></td>
|
||||
</th>
|
||||
<th class="w-28 pt-2 font-semibold text-sm">
|
||||
<td ng-bind="record.state"></td>
|
||||
</th>
|
||||
<th class="w-52 flex pt-2 font-semibold text-sm">
|
||||
<button class="bg-orange-500 px-2 py-1 text-white">Suspend</button>
|
||||
<button class="bg-orange-500 px-2 py-1 text-white">Edit</button>
|
||||
<button class="bg-orange-500 px-2 py-1 text-white">Delete</button>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -6,15 +6,14 @@ urlpatterns = [
|
||||
url(r'^$', views.loadUserHome, name='loadUsersHome'),
|
||||
url(r'^viewProfile$', views.viewProfile, name='viewProfile'),
|
||||
url(r'^viewProfileV2$', views.viewProfileV2, name='viewProfileV2'),
|
||||
url(r'^createUser', views.createUser, name='createUser'),
|
||||
|
||||
url(r'^createUser$', views.createUser, name='createUser'),
|
||||
url(r'^createUserV2$', views.createUserV2, name='createUserV2'),
|
||||
|
||||
url(r'^submitUserCreation', views.submitUserCreation, name='submitUserCreation'),
|
||||
url(r'^modifyUsers', views.modifyUsers, name="modifyUsers"),
|
||||
url(r'^fetchUserDetails', views.fetchUserDetails, name="fetchUserDetails"),
|
||||
url(r'^saveModifications', views.saveModifications, name="saveModifications"),
|
||||
|
||||
|
||||
url(r'^deleteUser', views.deleteUser, name="deleteUser"),
|
||||
url(r'^submitUserDeletion', views.submitUserDeletion, name="submitUserDeletion"),
|
||||
|
||||
@@ -32,6 +31,7 @@ urlpatterns = [
|
||||
url(r'^apiAccess$', views.apiAccess, name="apiAccess"),
|
||||
url(r'^saveChangesAPIAccess$', views.saveChangesAPIAccess, name="saveChangesAPIAccess"),
|
||||
url(r'^listUsers$', views.listUsers, name="listUsers"),
|
||||
url(r'^listUsersV2$', views.listUsersV2, name="listUsersV2"),
|
||||
url(r'^fetchTableUsers$', views.fetchTableUsers, name="fetchTableUsers"),
|
||||
url(r'^controlUserState$', views.controlUserState, name="controlUserState"),
|
||||
]
|
||||
|
||||
@@ -86,6 +86,27 @@ def createUser(request):
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
def createUserV2(request):
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
aclNames = ACLManager.unFileteredACLs()
|
||||
proc = httpProc(request, 'userManagment/createUserV2.html',
|
||||
{'aclNames': aclNames, 'securityLevels': SecurityLevel.list()})
|
||||
return proc.render()
|
||||
elif currentACL['changeUserACL'] == 1:
|
||||
aclNames = ACLManager.unFileteredACLs()
|
||||
proc = httpProc(request, 'userManagment/createUserV2.html',
|
||||
{'aclNames': aclNames, 'securityLevels': SecurityLevel.list()})
|
||||
return proc.render()
|
||||
elif currentACL['createNewUser'] == 1:
|
||||
aclNames = ['user']
|
||||
proc = httpProc(request, 'userManagment/createUserV2.html',
|
||||
{'aclNames': aclNames, 'securityLevels': SecurityLevel.list()})
|
||||
return proc.render()
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
def apiAccess(request):
|
||||
userID = request.session['userID']
|
||||
@@ -821,6 +842,37 @@ def listUsers(request):
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
def listUsersV2(request):
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
aclNames = ACLManager.unFileteredACLs()
|
||||
elif currentACL['changeUserACL'] == 1:
|
||||
aclNames = ACLManager.unFileteredACLs()
|
||||
elif currentACL['createNewUser'] == 1:
|
||||
aclNames = ['user']
|
||||
else:
|
||||
aclNames = []
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
resellerPrivUsers = ACLManager.userWithResellerPriv(userID)
|
||||
elif currentACL['resellerCenter'] == 1:
|
||||
resellerPrivUsers = ACLManager.userWithResellerPriv(userID)
|
||||
else:
|
||||
resellerPrivUsers = []
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
proc = httpProc(request, 'userManagment/listUsersV2.html',
|
||||
{'aclNames': aclNames, 'resellerPrivUsers': resellerPrivUsers})
|
||||
return proc.render()
|
||||
elif currentACL['listUsers'] == 1:
|
||||
proc = httpProc(request, 'userManagment/listUsersV2.html',
|
||||
{'aclNames': aclNames, 'resellerPrivUsers': resellerPrivUsers})
|
||||
return proc.render()
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
def fetchTableUsers(request):
|
||||
try:
|
||||
try:
|
||||
|
||||
@@ -3410,12 +3410,6 @@ function create_staging_checkbox_function() {
|
||||
newapp.controller('WPsiteHomeV2', function ($scope, $http, $timeout, $compile, $window) {
|
||||
|
||||
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: 'hanbokjnjdknvjfsnkjg habbi',
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
|
||||
var CheckBoxpasssword = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user