Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
centralize acl control
  • Loading branch information
usmannasir committed Feb 23, 2021
1 parent 72ae933 commit 07b5b27
Show file tree
Hide file tree
Showing 11 changed files with 893 additions and 819 deletions.
26 changes: 7 additions & 19 deletions CLManager/CLManagerMain.py
Expand Up @@ -10,7 +10,7 @@
from math import ceil
from websiteFunctions.models import Websites
from CLManager.models import CLPackages

from plogical.httpProc import httpProc

class CLManagerMain(multi.Thread):

Expand All @@ -27,29 +27,14 @@ def run(self):
self.submitCageFSInstall()
elif self.function == 'enableOrDisable':
self.enableOrDisable()

except BaseException as msg:
logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [ContainerManager.run]')

def renderC(self):

userID = self.request.session['userID']
currentACL = ACLManager.loadedACL(userID)

if currentACL['admin'] == 1:
pass
else:
return ACLManager.loadError()

ipFile = "/etc/cyberpanel/machineIP"
f = open(ipFile)
ipData = f.read()
ipAddress = ipData.split('\n', 1)[0]

data = {}
data['CL'] = 0
data['activatedPath'] = 0
data['ipAddress'] = ipAddress
CLPath = '/etc/sysconfig/cloudlinux'
activatedPath = '/home/cyberpanel/cloudlinux'

Expand All @@ -60,11 +45,14 @@ def renderC(self):
data['activatedPath'] = 1

if data['CL'] == 0:
return render(self.request, 'CLManager/notAvailable.html', data)
proc = httpProc(self.request, 'CLManager/notAvailable.html', data, 'admin')
return proc.render()
elif data['activatedPath'] == 0:
return render(self.request, 'CLManager/notAvailable.html', data)
proc = httpProc(self.request, 'CLManager/notAvailable.html', data, 'admin')
return proc.render()
else:
return render(self.request, 'CLManager/cloudLinux.html', data)
proc = httpProc(self.request, 'CLManager/cloudLinux.html', data, 'admin')
return proc.render()

def submitCageFSInstall(self):
try:
Expand Down
42 changes: 42 additions & 0 deletions baseTemplate/templates/baseTemplate/error.html
@@ -0,0 +1,42 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Home - CyberPanel" %}{% endblock %}
{% block content %}


{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->

<div class="container">
<div id="page-title">
<h2>{% trans "Home" %}</h2>
<p>{% trans "Use the tabs to navigate through the control panel." %}</p>
</div>


<!--- Hide statistics for non-admins--->

<div class="mx-10 col-lg-9 panel col-md-push-50">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "Something went wrong..." %}
</h3>

<div class="example-box-wrapper mt-5">
<div class="alert alert-danger">
<h4 class="alert-title">Error</h4>
<p>Error: {{ error_message }}</p>
</div>
</div>

</div>

</div>




</div>


{% endblock %}

0 comments on commit 07b5b27

Please sign in to comment.