本文整理汇总了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);
}