Commit 9b299495 by 王召彬

Auth注解添加allowTourist

parent cebe3a85
...@@ -21,6 +21,8 @@ class Auth ...@@ -21,6 +21,8 @@ class Auth
private $option='=='; private $option='==';
private $allowTourist=false;
public function __construct(array $values) public function __construct(array $values)
{ {
...@@ -31,6 +33,10 @@ class Auth ...@@ -31,6 +33,10 @@ class Auth
if (isset($values['option'])) { if (isset($values['option'])) {
$this->option = $values['option']; $this->option = $values['option'];
} }
if (isset($values['allowTourist'])) {
$this->allowTourist = $values['allowTourist'];
}
} }
...@@ -53,4 +59,24 @@ class Auth ...@@ -53,4 +59,24 @@ class Auth
{ {
return $this->option; return $this->option;
} }
/**
* Get the value of allowTourist
*/
public function getAllowTourist()
{
return $this->allowTourist;
}
/**
* Set the value of allowTourist
*
* @return self
*/
public function setAllowTourist($allowTourist)
{
$this->allowTourist = $allowTourist;
return $this;
}
} }
\ No newline at end of file
...@@ -26,12 +26,15 @@ class AuthCollector implements CollectorInterface ...@@ -26,12 +26,15 @@ class AuthCollector implements CollectorInterface
if ($objectAnnotation instanceof Auth) { if ($objectAnnotation instanceof Auth) {
$scope = $objectAnnotation->getScope(); $scope = $objectAnnotation->getScope();
$option = $objectAnnotation->getOption(); $option = $objectAnnotation->getOption();
$allowTourist = $objectAnnotation->getAllowTourist();
if ( $methodName ==='' ) { if ( $methodName ==='' ) {
self::$auth[$className]['scope'] = $scope; self::$auth[$className]['scope'] = $scope;
self::$auth[$className]['option'] = $option; self::$auth[$className]['option'] = $option;
self::$auth[$className]['allowTourist'] = $allowTourist;
} else { } else {
self::$auth[$className]['methods'][$methodName]['scope'] = $scope; self::$auth[$className]['methods'][$methodName]['scope'] = $scope;
self::$auth[$className]['methods'][$methodName]['option'] = $option; self::$auth[$className]['methods'][$methodName]['option'] = $option;
self::$auth[$className]['methods'][$methodName]['allowTourist'] = $allowTourist;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment