Commit 8322a775 authored by Côme Bernigaud's avatar Côme Bernigaud
Browse files

Fixes: #2919 By passing ACL system using a fake_userinfo class

Also fixed an error in check_defaultACLs
parent 3e8b8a82
......@@ -101,6 +101,8 @@ if (!session::global_is_set('config')) {
$config = session::global_get('config');
load_plist(FALSE);
IconTheme::loadThemes('themes');
/* Fake user bypassing acl system */
$ui = new fake_userinfo();
/* Call setup */
$display = "";
require_once("../setup/main.inc");
......
......@@ -22,6 +22,25 @@
require_once("class_setupStep.inc");
class fake_userinfo extends userinfo
{
function __construct()
{
global $config;
$this->config = &$config;
$this->cn = 'fake_cn';
$this->dn = 'fake_dn';
$this->uid = 'fake_uid';
$this->ip = $_SERVER['REMOTE_ADDR'];
/* This fake user have all rights */
$this->ignoreACL = TRUE;
/* Initialize ACL_CACHE */
$this->reset_acl_cache();
}
}
class setup
{
......
......@@ -102,32 +102,6 @@ class setupStep extends simplePlugin
return $tmp;
}
/* bypass acl system as there is no user login */
function acl_is_writeable($attribute, $skip_write = FALSE)
{
return TRUE;
}
function acl_is_readable($attribute)
{
return TRUE;
}
function acl_is_createable($base = "")
{
return TRUE;
}
function acl_is_removeable($base = "")
{
return TRUE;
}
function acl_is_moveable($base = "")
{
return TRUE;
}
function getacl($attribute, $skip_write = FALSE)
{
return 'cmdrw';
}
/* bypass LDAP loading */
protected function loadAttributes()
{
......
......@@ -968,6 +968,8 @@ class Step_Migrate extends setupStep
$dn = 'cn='.$role['cn'].','.get_ou('aclRoleRDN').$config->current['BASE'];
$ldap->cat($dn);
if ($ldap->count() == 0) {
$ldap->cd($config->current['BASE']);
$ldap->create_missing_trees(get_ou('aclRoleRDN').$config->current['BASE']);
$ldap->cd($dn);
$ldap->add($role);
if (!$ldap->success()) {
......@@ -975,7 +977,7 @@ class Step_Migrate extends setupStep
_('Migration error'),
sprintf(
_('Cannot add ACL role "%s":').'<br/><br/><i>%s</i>',
LDAP::fix($roledn), $ldap->get_error()
LDAP::fix($dn), $ldap->get_error()
),
ERROR_DIALOG
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment