Fork me on GitHub

#1 2012-01-26 04:46:23

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

[FIXED] More bugs in ACLs...

May I humbly suggest the following couple of corrections to lines that otherwise would prevent ACLs from functioning?:

[eyeroot]/system/kernal/kernal.eyecode, Line 469:

if(preg_match($value,$servParams[$i])) {

...works better if it was...

if($value === $servParams[$i]) {

As this is a straight string comparison, preg_match() is not the best thing to use. Also as $value is not set up to be used as a regex pattern, it fails anyway.

[eyeroot]/system/kernal/kernal.eyecode, Line 469:

if($count == count($ruleParams[0]['param'])) {

...works better as...

if($count > 0) {

If the rule from acl.xml being tested has more than one param, this wouldn't ever become true.


This one is more of a nicety to the enduser than a critical bug fix, but worth including, I think:

When an ACL denies a user an action, it does so without telling that user that the action was just denied. The user, not knowing why the action they're doing isn't working, gets annoyed/frustrated/sad/perplexed (delete as required) and so may think less of the system than they should.

The following is code that produces a message simply informing the user that the action was denied:

After lines 410, 423, 436 (ie. just before each of the "return false")...

msgACLreject(array('task'=>$params[0],'func'=>$servfunc));

...and the function that they call, to be placed about line 505 (after the function loadACLTables(), before the call to createFunctionAlias())...

function msgACLreject($params = null) {
	if($params == null || count($params) < 1 || !isset($params['func'])) {
		errorCodes('setErrorCode',array(INCORRECT_PARAMS));
		return false;
	}
	if ($params['func']==="launch") {
		$disObj = $params['task'];
	} else {
		$disObj = $params['func'];
	}
	eyeX('messageBox',array('content'=>$disObj.' has been disabled by your admin'));
}

Enjoy!

Also, after spending time elbow-deep in the workings for ACLs (metaphorically speaking), I thought I'd write a guide on how to set up ACLs... If I hear no complaints, I'll post in the "Help & Support" forum when the first draft is complete.

Offline

#2 2012-02-03 02:29:03

lucaferrario
Administrator
From: near Como, Italy
Registered: 2011-07-15
Posts: 91

Re: [FIXED] More bugs in ACLs...

s0600204, great job!
I'm going to review your bugfixes and commit them to SVN ;-)

Hey Lars, what about giving s0600204 an SVN account? smile

[EDIT]Bugfixes committed to SVN 7340. Many thanks!!![/EDIT]

PS = I'm sure that an howto would be greatly appreciated by a lot of users!!! As soon as you write it, please tell me here, so I will make that howto a sticky topic! (if you reply in this topic, I'll get an automatic email since I'm watching it, so I'll immediately have a look at it)

Last edited by lucaferrario (2012-02-03 02:43:50)

Offline

#3 2012-02-03 16:23:11

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

Re: [FIXED] More bugs in ACLs...

Thanks, Luca!

The first draft of the guide has been written, see http://forums.lars-sh.de/viewtopic.php?id=100 for details.


(P.S. I'm registered as 's0600204' on sourceforge if that helps Lars)

Offline

#4 2012-02-03 16:28:17

lucaferrario
Administrator
From: near Como, Italy
Registered: 2011-07-15
Posts: 91

Re: [FIXED] More bugs in ACLs...

Great job!!!
I've already sticked that topic. I've fastly read it, and it seems really well made! When you make the final version (or if you find out that the draft is good enough to become the final version), please tell me: I'll create an article on the main lars-sh.de site and attach the file!

Offline

#5 2012-02-03 18:14:51

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

Re: [FIXED] More bugs in ACLs...

Just added you to the project on sf.net. Sorry for the short answer, I'm in between of other work... Have fun smile !


Best regards,
Lars Knickrehm

The oneye project.

Offline

Board footer

Powered by FluxBB