|
|
@@ -139,4 +139,19 @@ func (s *OrganizeService) UserInRoleById(userId, RoleId string) bool {
|
|
|
roleidlist:=utils.RBAC.GetRolesForUserInDomain("uid_" + userId, utils.DOMAIN)
|
|
|
return strings.Contains(strings.Join(roleidlist, ","), "rid_" + strconv.Itoa(roleList[0].Id))
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+//获得category为unit的父节点
|
|
|
+func (s *OrganizeService) GetMyUnitDepartmentId(topid, uid string) string {
|
|
|
+ var entity Base_Organize
|
|
|
+ ids := s.GetAllParentByTopId(topid, uid)
|
|
|
+ if len(ids) <= 0 { //没有父节点
|
|
|
+ return topid
|
|
|
+ }
|
|
|
+ sql := "select * from Base_Organize where id in (" + ids + ") and Category='unit'"
|
|
|
+ s.DBE.Sql(sql).Get(&entity)
|
|
|
+ if &entity == nil || entity.Id <= 0 {//没有category为unit的父节点
|
|
|
+ return topid
|
|
|
+ }
|
|
|
+ return strconv.Itoa( entity.Id )
|
|
|
}
|