|
@@ -54,6 +54,8 @@ func DialysisApiRegistRouters() {
|
54
|
54
|
|
55
|
55
|
beego.Router("/api/dryweight/commit", &DialysisApiController{}, "Post:UploadDryWeight")
|
56
|
56
|
|
|
57
|
+ beego.Router("/api/func_per/get", &DialysisApiController{}, "Get:GetFuncPurview")
|
|
58
|
+
|
57
|
59
|
}
|
58
|
60
|
|
59
|
61
|
func (c *DialysisApiController) PostPrescription() {
|
|
@@ -4932,3 +4934,113 @@ func (c *DialysisApiController) UploadDryWeight() {
|
4932
|
4934
|
}
|
4933
|
4935
|
|
4934
|
4936
|
}
|
|
4937
|
+
|
|
4938
|
+func (this *DialysisApiController) GetFuncPurview() {
|
|
4939
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
4940
|
+ user_id := adminUserInfo.AdminUser.Id
|
|
4941
|
+ app_id := adminUserInfo.CurrentAppId
|
|
4942
|
+ org_id := adminUserInfo.CurrentOrgId
|
|
4943
|
+ create_url := this.GetString("create_url")
|
|
4944
|
+ modify_url := this.GetString("modify_url")
|
|
4945
|
+ modify_other_url := this.GetString("modify_other_url")
|
|
4946
|
+ del_url := this.GetString("del_url")
|
|
4947
|
+ del_other_url := this.GetString("del_other_url")
|
|
4948
|
+ exce_url := this.GetString("exce_url")
|
|
4949
|
+ check_url := this.GetString("check_url")
|
|
4950
|
+ modify_exce_url := this.GetString("modify_exce_url")
|
|
4951
|
+ module, _ := this.GetInt64("module", 0)
|
|
4952
|
+
|
|
4953
|
+ app_role, _ := service.GetAppRole(org_id, app_id, user_id)
|
|
4954
|
+ var is_has_create bool
|
|
4955
|
+ var is_has_modify bool
|
|
4956
|
+ var is_has_modify_other bool
|
|
4957
|
+ var is_has_del bool
|
|
4958
|
+ var is_has_del_other bool
|
|
4959
|
+ var is_has_exce bool
|
|
4960
|
+ var is_has_check bool
|
|
4961
|
+ var is_has_modify_exce bool
|
|
4962
|
+
|
|
4963
|
+ org, _ := service.GetOrgById(adminUserInfo.CurrentOrgId)
|
|
4964
|
+
|
|
4965
|
+ if adminUserInfo.AdminUser.Id != org.Creator {
|
|
4966
|
+
|
|
4967
|
+ if app_role != nil {
|
|
4968
|
+ if len(app_role.RoleIds) > 0 {
|
|
4969
|
+ roles := strings.Split(app_role.RoleIds, ",")
|
|
4970
|
+ var userRolePurviews string
|
|
4971
|
+ for _, item := range roles {
|
|
4972
|
+ role_id, _ := strconv.ParseInt(item, 10, 64)
|
|
4973
|
+ purviews, _ := service.GetRoleFuncPurviewIds(role_id)
|
|
4974
|
+ if len(userRolePurviews) == 0 {
|
|
4975
|
+ userRolePurviews = purviews
|
|
4976
|
+ } else {
|
|
4977
|
+ userRolePurviews = userRolePurviews + "," + purviews
|
|
4978
|
+ }
|
|
4979
|
+ }
|
|
4980
|
+ userRolePurviewsArr := RemoveRepeatedPurviewElement2(strings.Split(userRolePurviews, ","))
|
|
4981
|
+ funcPurviews, _ := service.FindAllFuncPurview(userRolePurviewsArr)
|
|
4982
|
+ for _, item := range funcPurviews {
|
|
4983
|
+ //for _, url := range strings.Split(item.Urlfor,","){
|
|
4984
|
+ if strings.Split(item.Urlfor, ",")[0] == create_url {
|
|
4985
|
+ is_has_create = true
|
|
4986
|
+ }
|
|
4987
|
+ if strings.Split(item.Urlfor, ",")[0] == modify_url {
|
|
4988
|
+ is_has_modify = true
|
|
4989
|
+ }
|
|
4990
|
+ if strings.Split(item.Urlfor, ",")[0] == modify_other_url {
|
|
4991
|
+ is_has_modify_other = true
|
|
4992
|
+ }
|
|
4993
|
+ if strings.Split(item.Urlfor, ",")[0] == del_url {
|
|
4994
|
+ is_has_del = true
|
|
4995
|
+ }
|
|
4996
|
+ if strings.Split(item.Urlfor, ",")[0] == del_other_url {
|
|
4997
|
+ is_has_del_other = true
|
|
4998
|
+ }
|
|
4999
|
+ if strings.Split(item.Urlfor, ",")[0] == exce_url {
|
|
5000
|
+ is_has_exce = true
|
|
5001
|
+ }
|
|
5002
|
+ if strings.Split(item.Urlfor, ",")[0] == check_url {
|
|
5003
|
+ is_has_check = true
|
|
5004
|
+ }
|
|
5005
|
+ if strings.Split(item.Urlfor, ",")[0] == modify_exce_url {
|
|
5006
|
+ is_has_modify_exce = true
|
|
5007
|
+ }
|
|
5008
|
+
|
|
5009
|
+ }
|
|
5010
|
+ } else {
|
|
5011
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRole)
|
|
5012
|
+ return
|
|
5013
|
+ }
|
|
5014
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
5015
|
+ "is_has_create": is_has_create,
|
|
5016
|
+ "is_has_modify": is_has_modify,
|
|
5017
|
+ "is_has_modify_other": is_has_modify_other,
|
|
5018
|
+ "is_has_del": is_has_del,
|
|
5019
|
+ "is_has_del_other": is_has_del_other,
|
|
5020
|
+ "is_has_exce": is_has_exce,
|
|
5021
|
+ "is_has_check": is_has_check,
|
|
5022
|
+ "is_has_modify_exce": is_has_modify_exce,
|
|
5023
|
+ "module": module,
|
|
5024
|
+ })
|
|
5025
|
+ } else {
|
|
5026
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserIsExit)
|
|
5027
|
+ return
|
|
5028
|
+
|
|
5029
|
+ }
|
|
5030
|
+
|
|
5031
|
+ } else {
|
|
5032
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
5033
|
+ "is_has_create": true,
|
|
5034
|
+ "is_has_modify": true,
|
|
5035
|
+ "is_has_modify_other": true,
|
|
5036
|
+ "is_has_del": true,
|
|
5037
|
+ "is_has_del_other": true,
|
|
5038
|
+ "is_has_exce": true,
|
|
5039
|
+ "is_has_check": true,
|
|
5040
|
+ "is_has_modify_exce": true,
|
|
5041
|
+ "module": true,
|
|
5042
|
+ })
|
|
5043
|
+
|
|
5044
|
+ }
|
|
5045
|
+
|
|
5046
|
+}
|