Fork me on GitHub

#1 2012-01-22 05:06:29

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

[FIXED] Question about multiple ACLs

I'm just curious, but is there any reason for disabling the ability to create more than one ACL?

What I mean is, if you create an ACL in system preferences, then create another, the second overwrites the first. And if you create a third, this overwrites the second.

I've looked at the code and I think I've found the part that causes it to overwrite rather than append, and I can correct it, but I was just wondering if there was a deliberate reason for it?

Offline

#2 2012-01-22 17:47:50

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: [FIXED] Question about multiple ACLs

Thanks for reporting. This is definitely a bug. Can you tell me how you fixed it? That way I don't need to check things myself...


Best regards,
Lars Knickrehm

The oneye project.

Offline

#3 2012-01-22 18:03:05

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: [FIXED] Question about multiple ACLs

Okay, fixed wink ...


Best regards,
Lars Knickrehm

The oneye project.

Offline

#4 2012-01-22 23:01:17

s0600204
Member
From: UK
Registered: 2012-01-22
Posts: 118
Website

Re: [FIXED] Question about multiple ACLs

Cool. I just copied your edit into my local install and it works fine...

...except (sorry)...

...I find that if I delete the acl.xml file from the (native) filesystem, refresh the oneye environment (ie. logout, login), then go back and create a new ACL rule, that the system creates two rules simultaneously, absolutely identical down to the id. Creating more ACL rules works as it should, with only one rule being created for each press of the 'add' button, and removing all of the rules and creating a new one also works as expected. It's just the first rule of a new acl.xml file is duplicated.

I think the problem lies at line 325. You see, lines 316-319 deal with creating the rule if the acl.xml file is being created. Line 325 just adds it to the document again. Of course, if the file has already been created, then line 315 returns false (or, more accurately, not-true) and so 316-319 aren't used and so 325 is needed.

Incidentally, my solution was...

if(!$config){
	$config = array('GACL' => array(array(
		'ACL' => array()
	)));
	$config['GACL'][0]['ACL'] = array($acl);
} else {
	if (!is_array($config[GACL][0])) {
		unset($config['GACL']);
		eyeXML('setXMLfile', array($file,$config));
	}
	$config['GACL'][0]['ACL'][] = $acl;
}

...yours, corrected is...

if(!$config){
	$config = array('GACL' => array(array(
	'ACL' => array()
	)));
	$config['GACL'][0]['ACL'] = array($acl);
} else {
	if (is_array($config['GACL'][0]) === false) {
		$config['GACL'][0] = array(
			'ACL' => array()
		);
	}
	$config['GACL'][0]['ACL'][] = $acl;
}

...both provide the same result.

Offline

#5 2012-04-14 03:16:31

lars-sh
Administrator
From: near Hamburg, Germany
Registered: 2011-07-14
Posts: 731
Website

Re: [FIXED] Question about multiple ACLs

Can you give me some feedback on the problem descibed in the above post using the latest SVN revision, please?

Best you open a new thread for such a bug?!


Best regards,
Lars Knickrehm

The oneye project.

Offline

#6 2012-04-14 15:54:30

Sable
Member
From: France
Registered: 2012-02-20
Posts: 87

Re: [FIXED] Question about multiple ACLs

Hi,

no problem here: the issue described was with the 0.8 release but it seems fixed for a long time (in SVN 7447 it was OK and, now, with the 7511 too )

Offline

Board footer

Powered by FluxBB