Commits

christiansalazar committed cc31217

ahora access control filter reporta error 401 cuando detecta access denied

  • Participants
  • Parent commits 0dac805

Comments (0)

Files changed (2)

components/CrugeAccessControlFilter.php

 						array('CrugeAccessControlFilter'),
 					);
 				}
+				
+				
+		la excepcion reportara error 401 indicando 'Access Denied'. Estandar http.
 		
 		@author: Christian Salazar H. <christiansalazarh@gmail.com> @bluyell
 	*/
 					// no esta autorizado
 					//
 					if(CrugeUtil::config()->allowUserAlways == false){
-						throw new CrugeException("acceso denegado",$actionItemName);
+						throw new CrugeException("acceso denegado",401,$actionItemName);
 					}
 				}
 			}
 				// no esta autorizado a la controladora en general.
 				//
 				if(CrugeUtil::config()->allowUserAlways == false){
-					throw new CrugeException("acceso denegado",$controllerItemName);
+					throw new CrugeException("acceso denegado",401,$controllerItemName);
 				}
 			}
 			

components/CrugeException.php

 class CrugeException extends CHttpException {
 	public $classParent;
 	public $extra;
+	public $code;
 	public function __construct($message,$code=500,$extra=""){
 		parent::__construct($message, $code);
+		$this->code = $code;
 		$this->extra = $extra;
 	}
 	public function __toString() {
 		/*
         return $this->classParent . ": [{$this->code}]: ".CrugeTranslator::t($this->message)."\n".$extra;
 		*/
-		return CrugeTranslator::t($this->message).$extra;
+		return CrugeTranslator::t($this->message).$extra."<br/>".$this->code;
     }
 }