Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
6263979f
Commit
6263979f
authored
Sep 02, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 角色修改 权限 控制
parent
12cf5a58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
15 deletions
+51
-15
center-manage/app/base/controller/impl/auth/roleCtl.js
+16
-6
center-manage/app/base/service/impl/auth/roleSve.js
+35
-9
No files found.
center-manage/app/base/controller/impl/auth/roleCtl.js
View file @
6263979f
var
system
=
require
(
"../../../system"
)
var
system
=
require
(
"../../../system"
)
const
http
=
require
(
"http"
)
const
http
=
require
(
"http"
)
const
querystring
=
require
(
'querystring'
);
const
querystring
=
require
(
'querystring'
);
var
settings
=
require
(
"../../../../config/settings"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
CtlBase
=
require
(
"../../ctl.base"
);
const
logCtl
=
system
.
getObject
(
"web.common.oplogCtl"
);
const
logCtl
=
system
.
getObject
(
"web.common.oplogCtl"
);
var
cacheBaseComp
=
null
;
var
cacheBaseComp
=
null
;
class
RoleCtl
extends
CtlBase
{
class
RoleCtl
extends
CtlBase
{
constructor
()
{
constructor
()
{
super
(
"auth"
,
CtlBase
.
getServiceName
(
RoleCtl
));
super
(
"auth"
,
CtlBase
.
getServiceName
(
RoleCtl
));
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
}
}
async
initNewInstance
(
pobj
,
queryobj
,
req
)
{
async
initNewInstance
(
pobj
,
queryobj
,
req
)
{
var
rtn
=
{};
var
rtn
=
{};
rtn
.
roles
=
[];
rtn
.
roles
=
[];
return
system
.
getResultSuccess
(
rtn
);
return
system
.
getResultSuccess
(
rtn
);
}
}
async
create
(
pobj
,
queryobj
,
req
)
{
async
create
(
pobj
,
queryobj
,
req
)
{
let
r
=
await
super
.
create
(
pobj
,
queryobj
,
req
)
let
r
=
await
super
.
create
(
pobj
,
queryobj
,
req
)
return
system
.
getResult
(
r
);
return
system
.
getResult
(
r
);
}
}
async
update
(
pobj
,
qobj
,
req
)
{
const
up
=
await
this
.
service
.
update
(
pobj
);
return
system
.
getResult
(
up
);
}
async
delete
(
pobj
,
qobj
,
req
)
{
const
up
=
await
this
.
service
.
delete
(
pobj
);
return
system
.
getResult
(
up
);
}
}
}
module
.
exports
=
RoleCtl
;
module
.
exports
=
RoleCtl
;
center-manage/app/base/service/impl/auth/roleSve.js
View file @
6263979f
const
system
=
require
(
"../../../system"
);
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
class
RoleService
extends
ServiceBase
{
class
RoleService
extends
ServiceBase
{
constructor
(){
constructor
()
{
super
(
"auth"
,
ServiceBase
.
getDaoName
(
RoleService
));
super
(
"auth"
,
ServiceBase
.
getDaoName
(
RoleService
));
//this.appDao=system.getObject("db.appDao");
//this.appDao=system.getObject("db.appDao");
}
}
async
findOneByCode
(
code
){
async
findOneByCode
(
code
)
{
return
this
.
dao
.
model
.
findOne
({
where
:{
code
:
code
}});
return
this
.
dao
.
model
.
findOne
({
where
:
{
code
:
code
}
});
}
async
update
(
qobj
)
{
const
data
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
company_id
:
Number
(
qobj
.
company_id
),
id
:
qobj
.
id
}
})
if
(
!
data
)
{
throw
new
Error
(
"无权限修改"
)
}
return
await
this
.
dao
.
update
(
qobj
);
}
async
delete
(
qobj
)
{
const
data
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
company_id
:
Number
(
qobj
.
company_id
),
id
:
qobj
.
id
}
})
if
(
!
data
)
{
throw
new
Error
(
"无权限修改"
)
}
return
await
this
.
dao
.
delete
(
qobj
);
}
}
}
}
module
.
exports
=
RoleService
;
module
.
exports
=
RoleService
;
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