(c *gin.Context)
| 1112 | } |
| 1113 | |
| 1114 | func batchQueryProjectUser(c *gin.Context) { |
| 1115 | r := struct { |
| 1116 | DB proto.DatabaseID `json:"db" json:"project" form:"db" form:"project" uri:"db" uri:"project" binding:"required,len=64"` |
| 1117 | ID []int64 `json:"id" form:"id" binding:"required,dive,required,gt=0"` |
| 1118 | }{} |
| 1119 | |
| 1120 | _ = c.ShouldBindUri(&r) |
| 1121 | |
| 1122 | if err := c.ShouldBind(&r); err != nil { |
| 1123 | abortWithError(c, http.StatusBadRequest, err) |
| 1124 | return |
| 1125 | } |
| 1126 | |
| 1127 | _, projectDB, err := getProjectDB(c, r.DB) |
| 1128 | if err != nil { |
| 1129 | _ = c.Error(err) |
| 1130 | abortWithError(c, http.StatusForbidden, ErrLoadProjectDatabaseFailed) |
| 1131 | return |
| 1132 | } |
| 1133 | |
| 1134 | users, err := model.GetProjectUsers(projectDB, r.ID) |
| 1135 | if err != nil { |
| 1136 | _ = c.Error(err) |
| 1137 | abortWithError(c, http.StatusInternalServerError, ErrGetProjectUserFailed) |
| 1138 | return |
| 1139 | } |
| 1140 | |
| 1141 | var resp = gin.H{} |
| 1142 | |
| 1143 | for _, u := range users { |
| 1144 | resp[fmt.Sprint(u.ID)] = gin.H{ |
| 1145 | "id": u.ID, |
| 1146 | "name": u.Name, |
| 1147 | "email": u.Email, |
| 1148 | "state": u.State.String(), |
| 1149 | "provider": u.Provider, |
| 1150 | "provider_uid": u.ProviderUID, |
| 1151 | "extra": u.Extra, |
| 1152 | "created": formatUnixTime(u.Created), |
| 1153 | "last_login": formatUnixTime(u.LastLogin), |
| 1154 | } |
| 1155 | } |
| 1156 | |
| 1157 | responseWithData(c, http.StatusOK, gin.H{ |
| 1158 | "users": resp, |
| 1159 | }) |
| 1160 | } |
| 1161 | |
| 1162 | func updateProjectTableRules(c *gin.Context) { |
| 1163 | r := struct { |
nothing calls this directly
no test coverage detected