|
@@ -64,7 +64,7 @@ namespace TEAMModelOS.Controllers.Both
|
|
|
/// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
[ProducesDefaultResponseType]
|
|
|
- [AuthToken(Roles = "teacher,admin")]
|
|
|
+ [AuthToken(Roles = "teacher,admin,visitor")]
|
|
|
[HttpPost("find-sync-info")]
|
|
|
//#if !DEBUG
|
|
|
// [Authorize(Roles = "IES")]
|
|
@@ -73,7 +73,7 @@ namespace TEAMModelOS.Controllers.Both
|
|
|
{
|
|
|
// int code =0;
|
|
|
//string msg = string.Empty;
|
|
|
- var tokenInfo = HttpContext.GetAuthTokenInfo();
|
|
|
+ var tokenInfo = HttpContext.GetAuthTokenKey("Scope");
|
|
|
|
|
|
string shortCode = $"{json["shortCode"]}";
|
|
|
string evaluationId = $"{json["evaluationId"]}";
|
|
@@ -105,12 +105,31 @@ namespace TEAMModelOS.Controllers.Both
|
|
|
}
|
|
|
if (evaluationSyncInfo.scope.Equals("school"))
|
|
|
{
|
|
|
- ResponseMessage response= await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync(tokenInfo.id, new PartitionKey($"Teacher-{evaluationSyncInfo.ownerId}"));
|
|
|
- if (!response.IsSuccessStatusCode)
|
|
|
+ if (!string.IsNullOrWhiteSpace(tokenInfo.school))
|
|
|
{
|
|
|
- await _dingDing.SendBotMsg($"根据试卷提取码搜索评测,检测到查询数据的教师未加入学校,数据归属{evaluationSyncInfo.scope},教师id:{tokenInfo.id},ownerId:{evaluationSyncInfo.ownerId}", GroupNames.成都开发測試群組);
|
|
|
- return Ok(new { code = 4, msg = "教师未加入当前评测的学校!" });
|
|
|
+ if (!evaluationSyncInfo.ownerId.Equals(tokenInfo.school))
|
|
|
+ {
|
|
|
+ return Ok(new { code = 4, msg = "教师未加入当前评测的学校!" });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (tokenInfo.keyData.Equals(Constant.ScopeTeacher))
|
|
|
+ {
|
|
|
+ ResponseMessage response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync(tokenInfo.id, new PartitionKey($"Teacher-{evaluationSyncInfo.ownerId}"));
|
|
|
+ if (!response.IsSuccessStatusCode)
|
|
|
+ {
|
|
|
+ await _dingDing.SendBotMsg($"根据试卷提取码搜索评测,检测到查询数据的教师未加入学校,数据归属{evaluationSyncInfo.scope},教师id:{tokenInfo.id},ownerId:{evaluationSyncInfo.ownerId}", GroupNames.成都开发測試群組);
|
|
|
+ return Ok(new { code = 4, msg = "教师未加入当前评测的学校!" });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ await _dingDing.SendBotMsg($"{tokenInfo.id},{tokenInfo.name},{json.ToJsonString()},评测客户端未绑定学校", GroupNames.成都开发測試群組);
|
|
|
+ return Ok(new { code = 12, msg = "评测客户端未绑定学校!" });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|