Move isadmin to template and rename it to oc_isadmin

This commit is contained in:
Lukas Reschke 2014-02-19 17:56:12 +01:00
parent 952584e9c7
commit 16262e3fd2
6 changed files with 4 additions and 27 deletions

View File

@ -10,6 +10,7 @@ var oc_webroot;
var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('data-user');
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 || {};

View File

@ -6,7 +6,7 @@
<!--[if gt IE 9]><html class="ng-csp ie"><![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>
<?php
p(!empty($_['application'])?$_['application'].' - ':'');

View File

@ -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;");
}

View File

@ -248,7 +248,7 @@ var UserList = {
if (user === OC.currentUser && group === 'admin') {
return false;
}
if (!isadmin && checked.length === 1 && checked[0] === group) {
if (!oc_isadmin && checked.length === 1 && checked[0] === group) {
return false;
}
$.post(
@ -280,7 +280,7 @@ var UserList = {
});
};
var label;
if (isadmin) {
if (oc_isadmin) {
label = t('settings', 'add group');
} else {
label = null;

View File

@ -72,5 +72,3 @@ $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
->actionInclude('settings/ajax/setloglevel.php');
$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
->actionInclude('settings/ajax/setsecurity.php');
$this->create('isadmin', '/settings/js/isadmin.js')
->actionInclude('settings/js/isadmin.php');

View File

@ -14,8 +14,6 @@ unset($items['admin']);
$_['subadmingroups'] = array_flip($items);
?>
<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkToRoute('isadmin'));?>"></script>
<div id="controls">
<form id="newuser" autocomplete="off">
<input id="newusername" type="text" placeholder="<?php p($l->t('Login Name'))?>" /> <input