35 $this->authenticationControllerName =
null;
36 if(!$auth_sets)
return true;
38 foreach($auth_sets as $set){
40 $controller_name =
null;
41 foreach($set as $name){
42 $authenticated = $this->authenticators[$name]->authenticated;
43 if($authenticated ===
false){
44 $this->
component(
'log')->debug(
'Negative authentication for ' . $name,__FILE__,__LINE__);
47 elseif(!$authenticated){
49 if(!$controller_name) $controller_name = $this->authenticators[$name]->controllerName;
52 if(!$missing)
return true;
53 if(!$best || ($missing < $best)){
55 $this->authenticationControllerName = $controller_name;
58 return $best ? null :
false;
66 return $this->
component(
'event')->trigger(self::EVENT_RIGHT_LEVEL,$this,$right);
76 $right = \Rsi\Str::part($right,self::RIGHT_LEVEL_SEPARATOR);
77 return $right ? $this->
level($right) >= $level :
true;
84 $this->
component(
'event')->trigger(self::EVENT_INVALIDATE,$this);
85 foreach($this->authenticators as $authenticator) $authenticator->invalidate();
86 $this->_id = $this->_record =
null;
87 if($this->authorative) $this->session->id =
null;
96 return $this->
component(
'event')->trigger(self::EVENT_NAME,$this,$id);
104 return $this->
component(
'event')->trigger(self::EVENT_RECORD,$this,$id);
111 public function id($code){
112 return $this->
component(
'event')->trigger(self::EVENT_ID,$this,$code);
116 if($this->_authenticators ===
null){
117 $this->_authenticators = [];
118 foreach($this->
config(
'authenticators',[]) as $name => $config){
119 $class_name = \Rsi\Record::get($config,
'className',__CLASS__ .
'\\Authenticator\\' . ucfirst($name));
120 $this->_authenticators[$name] =
new $class_name($this->_fred,$config);
127 if($value != $this->
id){
130 if($this->authorative) $this->session->id = $value;
135 return $this->authorative ? $this->session->id :
$this->_id;
139 if($this->_record ===
null) $this->_record = $this->
record($this->
id);
146 $this->_files =
new $class_name($this->_fred,$this->
config(
'files',[]) + [
'user' => $this]);
152 return \Rsi\Record::get($this->
record,$key);
155 protected function _set($key,$value){
156 $this->
component(
'event')->trigger(self::EVENT_SET,$this,$key,$value);
160 $this->authorative =
false;
161 $this->_authenticators =
null;