\app\service\adminAuth

后台权限服务实现者 Class Auth

Summary

Methods
Properties
Constants
getError()
setError()
setNoNeedLogin()
getNoNeedLogin()
needLogin()
setNoNeedAuth()
getNoNeedAuth()
needAuth()
getAuthList()
hasAuth()
No public properties found
No constants found
No protected methods found
$_error
$_noNeedLogin
$_noNeedAuth
N/A
No private methods found
No private properties found
N/A

Properties

$_error

$_error : 

Type

$_noNeedLogin

$_noNeedLogin : 

Type

$_noNeedAuth

$_noNeedAuth : 

Type

Methods

getError()

getError() 

setError()

setError(  $error) 

Parameters

$error

setNoNeedLogin()

setNoNeedLogin(array  $noNeedLogin = array()) 

设置无需登录的方法名数组

Parameters

array $noNeedLogin

getNoNeedLogin()

getNoNeedLogin() : array

获取无需登录的方法名数组

Returns

array

needLogin()

needLogin(boolean  $noNeedLogin = false) : boolean

当前节点是否需要登录

Parameters

boolean $noNeedLogin

Returns

boolean —

true:需要登录,false:不需要登录

setNoNeedAuth()

setNoNeedAuth(array  $noNeedAuth = array()) 

设置无需鉴权的方法名数组

Parameters

array $noNeedAuth

getNoNeedAuth()

getNoNeedAuth() : array

获取无需鉴权的方法名数组

Returns

array

needAuth()

needAuth(boolean  $noNeedAuth = false) : boolean

当前节点是否需要鉴权

Parameters

boolean $noNeedAuth

Returns

boolean —

true:需要登录,false:不需要登录

getAuthList()

getAuthList(  $userId) : array

获取某用户拥有的权限列表

Parameters

$userId

int 用户ID,当为空时,为获取当前登录用户权限列表

Throws

\think\db\exception\DataNotFoundException
\think\db\exception\DbException
\think\db\exception\ModelNotFoundException

Returns

array

hasAuth()

hasAuth(integer  $userId, string  $node) : boolean

获取某用户是否有某节点的权限

Parameters

integer $userId

登录用户ID

string $node

节点字符串

Throws

\think\db\exception\DataNotFoundException
\think\db\exception\DbException
\think\db\exception\ModelNotFoundException

Returns

boolean