Skip to content

Commit

Permalink
improve tips & notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
vistart committed May 6, 2017
1 parent 43263ce commit 5af89bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion traits/BlameableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public function getHost()
/**
* Set host of this model.
* @param string $host
* @return type
* @return string|boolean
*/
public function setHost($host)
{
Expand Down
6 changes: 3 additions & 3 deletions traits/SubsidiaryTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ public function getSubsidiaries($name, $limit = 'all', $page = 0)
if (!method_exists($query, 'createdBy')) {
return null;
}
return $class::find()->createdBy($this)->page($limit, $page)->all();
return $query->createdBy($this)->page($limit, $page)->all();
}

/**
* @param $name
* @param $arguments
* @return type
* @return mixed
*/
public function __call($name, $arguments)
{
Expand Down Expand Up @@ -202,7 +202,7 @@ public function create($className, $config = [], $loadDefault = true, $skipIfSet
*
* @param string $name
* @param array $config
* @return type
* @return mixed
*/
public function createSubsidiary($name, $config)
{
Expand Down
17 changes: 14 additions & 3 deletions web/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,25 @@
class User extends \yii\web\User
{
private $_access = [];


/**
* Get the GUID of identity.
* If no user logged-in, null will be given.
* @return null|string
*/
public function getGuid()
{
$identity = $this->getIdentity();
/* @var $identity BaseUserModel */
return $identity !== null ? $identity->getGUID() : null;
}


/**
* @param string $permissionName
* @param array $params
* @param bool $allowCaching
* @return bool|mixed
*/
public function can($permissionName, $params = [], $allowCaching = true)
{
if ($allowCaching && empty($params) && isset($this->_access[$permissionName])) {
Expand All @@ -44,4 +55,4 @@ public function can($permissionName, $params = [], $allowCaching = true)

return $access;
}
}
}

0 comments on commit 5af89bb

Please sign in to comment.