Move isadmin to template and rename it to oc_isadmin
This commit is contained in:
parent
952584e9c7
commit
16262e3fd2
|
@ -10,6 +10,7 @@ var oc_webroot;
|
||||||
|
|
||||||
var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user');
|
var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user');
|
||||||
var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken');
|
var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken');
|
||||||
|
var oc_isadmin = document.getElementsByTagName('head')[0].getAttribute('data-isAdmin');
|
||||||
|
|
||||||
window.oc_config = window.oc_config || {};
|
window.oc_config = window.oc_config || {};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<!--[if gt IE 9]><html class="ng-csp ie"><![endif]-->
|
<!--[if gt IE 9]><html class="ng-csp ie"><![endif]-->
|
||||||
<!--[if !IE]><!--><html class="ng-csp"><!--<![endif]-->
|
<!--[if !IE]><!--><html class="ng-csp"><!--<![endif]-->
|
||||||
|
|
||||||
<head data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>">
|
<head data-isAdmin="<?php p(OC_User::isAdminUser(OC_User::getUser()) ? 'true' : 'false'); ?>" data-user="<?php p($_['user_uid']); ?>" data-requesttoken="<?php p($_['requesttoken']); ?>">
|
||||||
<title>
|
<title>
|
||||||
<?php
|
<?php
|
||||||
p(!empty($_['application'])?$_['application'].' - ':'');
|
p(!empty($_['application'])?$_['application'].' - ':'');
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Copyright (c) 2013 Lukas Reschke <lukas@statuscode.ch>
|
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
|
||||||
* later.
|
|
||||||
* See the COPYING-README file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Set the content type to Javascript
|
|
||||||
header("Content-type: text/javascript");
|
|
||||||
|
|
||||||
// Disallow caching
|
|
||||||
header("Cache-Control: no-cache, must-revalidate");
|
|
||||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
|
||||||
|
|
||||||
if (OC_User::isAdminUser(OC_User::getUser())) {
|
|
||||||
echo("var isadmin = true;");
|
|
||||||
} else {
|
|
||||||
echo("var isadmin = false;");
|
|
||||||
}
|
|
|
@ -248,7 +248,7 @@ var UserList = {
|
||||||
if (user === OC.currentUser && group === 'admin') {
|
if (user === OC.currentUser && group === 'admin') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isadmin && checked.length === 1 && checked[0] === group) {
|
if (!oc_isadmin && checked.length === 1 && checked[0] === group) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.post(
|
$.post(
|
||||||
|
@ -280,7 +280,7 @@ var UserList = {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var label;
|
var label;
|
||||||
if (isadmin) {
|
if (oc_isadmin) {
|
||||||
label = t('settings', 'add group');
|
label = t('settings', 'add group');
|
||||||
} else {
|
} else {
|
||||||
label = null;
|
label = null;
|
||||||
|
|
|
@ -72,5 +72,3 @@ $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
|
||||||
->actionInclude('settings/ajax/setloglevel.php');
|
->actionInclude('settings/ajax/setloglevel.php');
|
||||||
$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
|
$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
|
||||||
->actionInclude('settings/ajax/setsecurity.php');
|
->actionInclude('settings/ajax/setsecurity.php');
|
||||||
$this->create('isadmin', '/settings/js/isadmin.js')
|
|
||||||
->actionInclude('settings/js/isadmin.php');
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ unset($items['admin']);
|
||||||
$_['subadmingroups'] = array_flip($items);
|
$_['subadmingroups'] = array_flip($items);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkToRoute('isadmin'));?>"></script>
|
|
||||||
|
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
<form id="newuser" autocomplete="off">
|
<form id="newuser" autocomplete="off">
|
||||||
<input id="newusername" type="text" placeholder="<?php p($l->t('Login Name'))?>" /> <input
|
<input id="newusername" type="text" placeholder="<?php p($l->t('Login Name'))?>" /> <input
|
||||||
|
|
Loading…
Reference in New Issue