Fastadmin permission management

Get the information of the currently logged-in administrator or logged-in user

The first is to use Session to get the administrator information
\think\Session::get('admin');
The second is to use the singleton method to get
KaTeX parse error: Undefined control sequence: \app at position 8: auth = \̲A̲p̲p̲\admin\library\… this->auth->id to get the ID of the currently logged-in member,
$this->auth-> field clerk to get other information of the logged-in member, if you need to get the currently logged-in information in the model at the front desk User information,
get the Auth object in the following way:
$auth = \app\common\library\Auth::install();
//Get the membership model
$user = $auth->getUser();
//Get the administrator Belonging to the group
$this->auth->getGroups()
//Get the group ID that the administrator belongs to
$this->auth->getGroupIds()
//Remove the group that the current administrator has permissions
$this->auth- >getChildrenGroupIds(true)

Show columns based on permissions

if (Config.type != 1) {
stvisible = false;
} else {
stvisible = true;
}
{
field: ‘jingxuan’,
title: __(‘Jingxuan’),
searchList: {“1”: __(‘Jingxuan 1’), “0”: __(‘Jingxuan 0’)},
formatter: Table.api.formatter.toggle,
visible: stvisible
},

Assigned batch update operation prompts no permission problem (switch)

Note that modifying the $multiFields
switch is only allowed to modify the status field of the database when clicked. If our switch is not a status field, we need to define
protected $multiFields="id,name,swith" in the controller corresponding to the server . , Multiple fields are separated by

Guess you like

Origin blog.csdn.net/weixin_43784997/article/details/115292830