DMXzone Security Provider PHP Support Product Page

Solved

Redirect on security authentication fails to redirect and gives error.

Reported 28 Jun 2014 03:06:06
1
has this problem
28 Jun 2014 03:06:06 steve smith posted:
IF accessing a page without being authenticated I always get an error similar to: Out of memory (allocated 30408704) (tried to allocate 128 bytes) The actual numbers may differ depending on the page but the results are the same. The pages should be redirecting the page to login on failure but I always get messages like that. If I open a separate browser window and login to authenticate, then refresh the other page all is well.

The redirect works when authenticating and the person doesn't have permission for a page. The problem occurs when going directly to a protected page before authenticating. (for example if the page was bookmarked) This is definitely not the desired result. The user is supposed to be redirected to the page to login.

Replies

Replied 30 Jun 2014 09:19:21
30 Jun 2014 09:19:21 Teodor Kuduschiev replied:
Hi Steve,
Please provide a link to your page, where we can check this.
Replied 02 Jul 2014 14:30:42
02 Jul 2014 14:30:42 steve smith replied:
Replied 07 Jul 2014 10:06:32
07 Jul 2014 10:06:32 Teodor Kuduschiev replied:
Hello,
Please send a link to your login page as well as the login details to:
Replied 08 Jul 2014 07:41:07
08 Jul 2014 07:41:07 steve smith replied:
Details sent.
Replied 11 Jul 2014 12:59:25
11 Jul 2014 12:59:25 Teodor Kuduschiev replied:
Hello,
There was a minor problem in the code.. causing so much problems.
Please open the following file: ScriptLibrary\dmxDatabaseConnector\sqlBuilder.php
Go to line: 339 and change:
 'operator' => (is_null($value) ? '' : $operator),

to
'operator' => (is_null($value) ? '=' : $operator), 


This will fix all of the issue causing the Allowed memory size ... errors. We will include this fix in the upcoming update.
Replied 11 Jul 2014 14:45:50
11 Jul 2014 14:45:50 Teodor Kuduschiev replied:
There is another change that needs to be made in the following file:
ScriptLibrary\dmxSecurityProviderdmxSecurityProvider.php
Find and replace:
line 133-143:
public function restrict($opts = array()) {
		if (is_string($opts) && $opts[0] == '{') {
			$opts = json_decode($opts);
		} else {
			$opts = (object)array('permissions' => $opts);
		}
		$opts->permissions = is_array($opts->permissions) ? $opts->permissions : array($opts->permissions);
		if (!$this->identity) $this->login(_request('username'), _request('password'));
		if (!$this->identity) $this->unauthorized($opts->loginUrl);
		if (!$this->provider->permissions($this->identity, $opts->permissions)) $this->forbidden($opts->forbiddenUrl);
	}

with
public function restrict($opts = array()) {
		if (is_string($opts) && $opts[0] == '{') {
			$opts = json_decode($opts);
		} else {
			$opts = (object)array('permissions' => $opts);
		}
		if (!$this->identity) $this->login(_request('username'), _request('password'));
		if (!$this->identity) $this->unauthorized($opts->loginUrl);
		if ($opts->permissions) {
			$opts->permissions = is_array($opts->permissions) ? $opts->permissions : array($opts->permissions);
			if (!$this->provider->permissions($this->identity, $opts->permissions)) $this->forbidden($opts->forbiddenUrl);
		}
	}

Replied 12 Jul 2014 02:36:14
12 Jul 2014 02:36:14 steve smith replied:
Teodor,
Those lines did the job. Seems to be working like a charm. Looking forward to the official update. Thanks

Reply to this topic