/** * */ private function registerScopes($loginId) { $model = DF::model('Authentication.LoginsToScopes'); $qst = Query::create($model)->where(Caml::eq('loginId', ':loginId'))->toSql(); $rst = $model->execute($qst, ['loginId' => $loginId])->result(); if ($rst) { foreach ($rst as $row) { $this->setScopes($row['scope']); } } return $this; }
/** * */ private function commit() { foreach ($this->settings as $section => $sectionData) { foreach ($sectionData as $varname => $valueData) { if ($valueData['isDirty']) { if ($valueData['isNew']) { $data = array('domain' => $this->domain, 'section' => $section, 'varname' => $varname, 'value' => $valueData['value']); $this->insert($data); } else { $data = array('value' => $valueData['value']); $where = array(Caml::eq('domain', $this->domain), Caml::eq('section', $section), Caml::eq('varname', $varname)); $this->update($data, $where); } $this->settings[$section][$varname]['isDirty'] = false; $this->settings[$section][$varname]['isNew'] = false; } } } }
/** * */ public function getByIdentifierAndToken($identifier, $token) { $qst = Query::create($this)->select('loginId', 'username', 'password', 'salt', 'timeout')->where(Caml::eq('identifier', '?'))->where(Caml::eq('token', '?'))->toSql(); $row = array(); $rst = $this->execute($qst, array($identifier, $token))->result(); if (count($rst)) { $row = $rst[0]; return $row; } return false; }