作者 唐旭辉

存储

... ... @@ -34,7 +34,7 @@ func (c *RbacController) RoleAdd() {
msg = protocol.BadRequestParam("1")
return
}
err := serverbac.RoleAdd(param)
_, err := serverbac.RoleAdd(param)
msg = protocol.NewReturnResponse(nil, err)
return
}
... ... @@ -58,7 +58,7 @@ func (c *RbacController) RoleUpdate() {
return
}
err := serverbac.RoleEdit(param)
_, err := serverbac.RoleEdit(param)
msg = protocol.NewReturnResponse(nil, err)
return
}
... ...
... ... @@ -106,3 +106,13 @@ func DeleteRole(id int) (err error) {
}
return
}
func DeleteRoleByPid(pid int) (err error) {
// o := orm.NewOrm()
// var num int64
// deleteAt = time.Now()
// o.QueryTable(&Role{}).Filter("pid", pid).Update(orm.Params{})
return
}
... ...
... ... @@ -17,9 +17,9 @@ func init() {
beego.NSRouter("/department", &controllers.CompanyController{}, "delete:DepartmentDelete"),
),
beego.NSNamespace("/rbac",
beego.NSRouter("/role", &controllers.CompanyController{}, "post:RoleAdd"),
beego.NSRouter("/role", &controllers.CompanyController{}, "put:RoleUpdate"),
beego.NSRouter("/role", &controllers.CompanyController{}, "delete:RoleDelete"),
beego.NSRouter("/role", &controllers.RbacController{}, "post:RoleAdd"),
beego.NSRouter("/role", &controllers.RbacController{}, "put:RoleUpdate"),
beego.NSRouter("/role", &controllers.RbacController{}, "delete:RoleDelete"),
),
)
... ...
... ... @@ -53,6 +53,10 @@ func RoleDelete(param protocol.RequestRoleDelete) error {
log.Error(e.Error())
return protocol.NewErrWithMessage("1", e)
}
//TODO
if role.Types == models.ROLETYPES_GROUP {
}
if err := models.DeleteRole(param.RoleID); err != nil {
e := fmt.Errorf("DeleteRole err:%s", err)
log.Error(e.Error())
... ...