Browse Source

Correct edge case where Role is joined in

euromark 12 years ago
parent
commit
5d275928ed

+ 2 - 0
Controller/Component/Auth/TinyAuthorize.php

@@ -73,6 +73,8 @@ class TinyAuthorize extends BaseAuthorize {
 		if (isset($user[$this->settings['aclModel']])) {
 			if (isset($user[$this->settings['aclModel']][0]['id'])) {
 				$roles = Hash::extract($user[$this->settings['aclModel']], '{n}.id');
+			} elseif (isset($user[$this->settings['aclModel']]['id'])) {
+				$roles = array($user[$this->settings['aclModel']]['id']);
 			} else {
 				$roles = (array)$user[$this->settings['aclModel']];
 			}

+ 3 - 3
Controller/Component/CommonComponent.php

@@ -560,9 +560,9 @@ class CommonComponent extends Component {
 	 * @return void
 	 */
 	public function forceCache($seconds = HOUR) {
-		header('Cache-Control: public, max-age=' . $seconds);
-		header('Last-modified: ' . gmdate("D, j M Y H:i:s", time()) . " GMT");
-		header('Expires: ' . gmdate("D, j M Y H:i:s", time() + $seconds) . " GMT");
+		$this->Controller->response->header('Cache-Control', 'public, max-age=' . $seconds);
+		$this->Controller->response->header('Last-modified', gmdate("D, j M Y H:i:s", time()) . " GMT");
+		$this->Controller->response->header('Expires', gmdate("D, j M Y H:i:s", time() + $seconds) . " GMT");
 	}
 
 	/**