本文整理匯總了PHP中source\LuLu::getIdentity方法的典型用法代碼示例。如果您正苦於以下問題:PHP LuLu::getIdentity方法的具體用法?PHP LuLu::getIdentity怎麽用?PHP LuLu::getIdentity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類source\LuLu
的用法示例。
在下文中一共展示了LuLu::getIdentity方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMessagePrefix
public function getMessagePrefix($message)
{
if ($this->prefix !== null) {
return call_user_func($this->prefix, $message);
}
$ip = Utility::getIp();
$userID = LuLu::getIdentity()->username;
if (empty($userID)) {
return "[{$ip}]";
} else {
return "[{$ip}]<br/>[{$userID}]";
}
}
示例2: actionCreate
public function actionCreate()
{
$model = new Content();
$model->user_id = LuLu::getIdentity()->id;
$model->user_name = LuLu::getIdentity()->username;
$model->content_type = $this->content_type;
$model->loadDefaultValues();
$bodyModel = $this->findBodyModel();
$bodyModel->loadDefaultValues();
if ($this->saveContent($model, $bodyModel)) {
return $this->redirect(['index']);
}
return $this->render('create', ['model' => $model, 'bodyModel' => $bodyModel]);
}
示例3: beforeValidate
public function beforeValidate()
{
if (!$this->userValidate) {
return parent::beforeValidate();
}
if (parent::beforeValidate()) {
if ($this->hasAttribute('sort_num')) {
if ($this->sort_num === null || $this->sort_num === '') {
$this->sort_num = Constants::getSortNum();
}
}
if ($this->hasAttribute('created_at')) {
if (empty($this->created_at)) {
$this->created_at = time();
}
}
if ($this->hasAttribute('updated_at')) {
$this->updated_at = time();
}
if ($this->hasAttribute('created_by')) {
if (empty($this->created_by)) {
$this->created_by = LuLu::getIdentity()->username;
}
}
if ($this->hasAttribute('updated_by')) {
if (empty($this->updated_by)) {
$this->updated_by = LuLu::getIdentity()->username;
}
}
return true;
}
return false;
}
示例4: checkHomePermission
public function checkHomePermission($permission = null, $params = [], $user = null)
{
if ($user === null) {
$user = LuLu::getIdentity()->username;
}
if ($permission === null) {
$permission = LuLu::getApp()->controller->uniqueId;
}
$permission = 'home_' . $permission;
$rows = $this->getPermissionsByUser($user);
if (!isset($rows[$permission])) {
return false;
}
return $this->executeRule($rows[$permission], $params, $user);
}
示例5: checkPermission
public function checkPermission($role = null, $permission = null, $params = [])
{
if ($role === null) {
$role = LuLu::getIdentity()->role;
}
if ($permission === null) {
$m = LuLu::getApp()->controller->module->id;
$c = LuLu::getApp()->controller->id;
$permission = empty($m) ? $c : $m . '/' . $c;
}
$rows = $this->getPermissionsByRole($role);
if (!isset($rows[$permission])) {
return false;
}
return $this->executeRule($role, $rows[$permission], $params);
}