作者 唐旭辉

bug 修复,主管获得所有

... ... @@ -245,7 +245,7 @@ func (c *AuthController) Me() {
if err != nil {
log.Error("获取用户的公司失败")
}
permissionMap := serveauth.GetUserMenuPermission(userid)
permissionMap := serveauth.GetUserMenuPermission(userid, companyid)
data := map[string]interface{}{
"user": userinfo,
"menus": menus,
... ...
... ... @@ -370,11 +370,22 @@ func GetUserHasMenu(userid, companyid int64) ([]protocol.ResponseUserHasMenu, er
return list, nil
}
func GetUserMenuPermission(userid int64) map[string]serverbac.PermissionOptionObject {
func GetUserMenuPermission(userid int64, companyid int64) map[string]serverbac.PermissionOptionObject {
var (
permissionMap = make(map[string]serverbac.PermissionOptionObject)
err error
companyinfo *models.Company
)
companyinfo, err = models.GetCompanyById(companyid)
if err != nil {
log.Error("获取公司信息失败:%s", err)
return permissionMap
}
if companyinfo.AdminId == userid {
permissionMap = AdminUserMenuPersmission()
return permissionMap
}
permissionMap, err = redisdata.GetUserPermissionAll(userid)
if err != nil {
log.Error("获取权限数据失败 :%s", err)
... ... @@ -391,6 +402,28 @@ func GetUserMenuPermission(userid int64) map[string]serverbac.PermissionOptionOb
return permissionMap
}
func AdminUserMenuPersmission() map[string]serverbac.PermissionOptionObject {
permissionMap := make(map[string]serverbac.PermissionOptionObject)
permissionMap[serverbac.M_ENTERPRISE] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_SYSTEM] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_ENTERPRISE_PROFILE] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_ENTERPRISE_ORGANIZATION] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_ENTERPRISE_EMPLOYEE_POST] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_ENTERPRISE_EMPLOYEE_ROLE] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_ENTERPRISE_EMPLOYEE] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_SYSTEM_OPPORTUNITY_TEMPLATE] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_SYSTEM_RATING] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_SYSTEM_ANNOUNCEMENT] = &serverbac.PermissionOptionBase{Check: 1}
permissionMap[serverbac.M_SYSTEM_OPPORTUNITY] = &serverbac.OptionOpportunity{
Check: serverbac.OpportunityCheckLv4,
EditSorce: 1,
EditPublicStatus: 1,
CloseChance: 1,
EditChance: 1,
}
return permissionMap
}
func LoginAuthBySmsCode(uclientReturn *ucenter.ResponseLoginSms) (
protocol.LoginAuthToken, error) {
var (
... ...