Skip to content

Commit 07b5b27

Browse files
committed
centralize acl control
1 parent 72ae933 commit 07b5b27

11 files changed

Lines changed: 893 additions & 819 deletions

File tree

CLManager/CLManagerMain.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from math import ceil
1111
from websiteFunctions.models import Websites
1212
from CLManager.models import CLPackages
13-
13+
from plogical.httpProc import httpProc
1414

1515
class CLManagerMain(multi.Thread):
1616

@@ -27,29 +27,14 @@ def run(self):
2727
self.submitCageFSInstall()
2828
elif self.function == 'enableOrDisable':
2929
self.enableOrDisable()
30-
3130
except BaseException as msg:
3231
logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [ContainerManager.run]')
3332

3433
def renderC(self):
3534

36-
userID = self.request.session['userID']
37-
currentACL = ACLManager.loadedACL(userID)
38-
39-
if currentACL['admin'] == 1:
40-
pass
41-
else:
42-
return ACLManager.loadError()
43-
44-
ipFile = "/etc/cyberpanel/machineIP"
45-
f = open(ipFile)
46-
ipData = f.read()
47-
ipAddress = ipData.split('\n', 1)[0]
48-
4935
data = {}
5036
data['CL'] = 0
5137
data['activatedPath'] = 0
52-
data['ipAddress'] = ipAddress
5338
CLPath = '/etc/sysconfig/cloudlinux'
5439
activatedPath = '/home/cyberpanel/cloudlinux'
5540

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

6247
if data['CL'] == 0:
63-
return render(self.request, 'CLManager/notAvailable.html', data)
48+
proc = httpProc(self.request, 'CLManager/notAvailable.html', data, 'admin')
49+
return proc.render()
6450
elif data['activatedPath'] == 0:
65-
return render(self.request, 'CLManager/notAvailable.html', data)
51+
proc = httpProc(self.request, 'CLManager/notAvailable.html', data, 'admin')
52+
return proc.render()
6653
else:
67-
return render(self.request, 'CLManager/cloudLinux.html', data)
54+
proc = httpProc(self.request, 'CLManager/cloudLinux.html', data, 'admin')
55+
return proc.render()
6856

6957
def submitCageFSInstall(self):
7058
try:
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{% extends "baseTemplate/index.html" %}
2+
{% load i18n %}
3+
{% block title %}{% trans "Home - CyberPanel" %}{% endblock %}
4+
{% block content %}
5+
6+
7+
{% get_current_language as LANGUAGE_CODE %}
8+
<!-- Current language: {{ LANGUAGE_CODE }} -->
9+
10+
<div class="container">
11+
<div id="page-title">
12+
<h2>{% trans "Home" %}</h2>
13+
<p>{% trans "Use the tabs to navigate through the control panel." %}</p>
14+
</div>
15+
16+
17+
<!--- Hide statistics for non-admins--->
18+
19+
<div class="mx-10 col-lg-9 panel col-md-push-50">
20+
<div class="panel-body">
21+
<h3 class="content-box-header">
22+
{% trans "Something went wrong..." %}
23+
</h3>
24+
25+
<div class="example-box-wrapper mt-5">
26+
<div class="alert alert-danger">
27+
<h4 class="alert-title">Error</h4>
28+
<p>Error: {{ error_message }}</p>
29+
</div>
30+
</div>
31+
32+
</div>
33+
34+
</div>
35+
36+
37+
38+
39+
</div>
40+
41+
42+
{% endblock %}

0 commit comments

Comments
 (0)