Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
9d792483
Commit
9d792483
authored
Feb 01, 2018
by
zfc
Committed by
hujun
Mar 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台权限控制
parent
137cb709
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
6 deletions
+30
-6
Basic.php
application/index/extend/Basic.php
+30
-6
No files found.
application/index/extend/Basic.php
View file @
9d792483
...
...
@@ -63,6 +63,8 @@ class Basic extends Controller
$this
->
userVerify
();
}
$this
->
userAuth
(
$requestPath
);
$this
->
userAuth
(
$requestPath
);
}
...
...
@@ -83,12 +85,34 @@ class Basic extends Controller
foreach
(
$session
as
$v
){
}
public
function
userAuth
(){
$request
=
\think\Request
::
instance
();
$r
=
$request
->
controller
();
$route
=
$request
->
module
();
$name
=
$request
->
action
();
$url
=
$route
.
"/"
.
$name
;
/**
* 权限判定
* @param $requestPath
* @return Response
*/
public
function
userAuth
(
$requestPath
){
$session
=
Session
::
get
(
"userinfo.nav"
);
$r
=
0
;
//判断当前控制器用户是否拥有进入权限
foreach
(
$session
as
$v
){
//不区分大小写
if
(
strcasecmp
(
trim
(
$v
[
'name'
]),
$requestPath
)
==
0
){
$r
=
$v
;
}
}
if
(
$r
==
'0'
){
if
(
$this
->
request
->
isAjax
()){
return
$this
->
response
(
'300'
,
'没有权限'
);
}
else
{
// $this->error('没有当前页面权限');
}
}
else
{
Session
::
set
(
"userRule"
,
$r
);
}
//print_r($r);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment