#51 new publish permission
This commit is contained in:
parent
efc91c632f
commit
7ae09c2783
@ -311,13 +311,13 @@ namespace RMuseum.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moderate pending narration
|
||||
/// Moderate pending narration (for moderating other users' recitations you also need recitation:moderate permission)
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("moderate/{id}")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.AudioRecitationEntityShortName + ":" + RMuseumSecurableItem.ModerateOperationShortName)]
|
||||
[Authorize(Policy = RMuseumSecurableItem.AudioRecitationEntityShortName + ":" + RMuseumSecurableItem.PublishOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(RecitationViewModel))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.Forbidden, Type = typeof(string))]
|
||||
@ -329,6 +329,34 @@ namespace RMuseum.Controllers
|
||||
|
||||
Guid loggedOnUserId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "UserId").Value);
|
||||
|
||||
var narration = await _audioService.Get(id);
|
||||
if (!string.IsNullOrEmpty(narration.ExceptionString))
|
||||
{
|
||||
return BadRequest(narration.ExceptionString);
|
||||
}
|
||||
|
||||
if (narration.Result == null)
|
||||
return NotFound();
|
||||
|
||||
if (narration.Result.Owner.Id != loggedOnUserId)
|
||||
{
|
||||
Guid sessionId = new Guid(User.Claims.FirstOrDefault(c => c.Type == "SessionId").Value);
|
||||
RServiceResult<bool>
|
||||
serviceResult =
|
||||
await _userPermissionChecker.Check
|
||||
(
|
||||
loggedOnUserId,
|
||||
sessionId,
|
||||
RMuseumSecurableItem.AudioRecitationEntityShortName,
|
||||
RMuseumSecurableItem.ModerateOperationShortName
|
||||
);
|
||||
if (!string.IsNullOrEmpty(serviceResult.ExceptionString))
|
||||
return BadRequest(serviceResult.ExceptionString);
|
||||
|
||||
if (!serviceResult.Result)
|
||||
return StatusCode((int)HttpStatusCode.Forbidden);
|
||||
|
||||
}
|
||||
|
||||
var res = await _audioService.ModeratePoemNarration(id, loggedOnUserId, model);
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
@ -504,7 +532,7 @@ namespace RMuseum.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("retrypublish")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.AudioRecitationEntityShortName + ":" + RMuseumSecurableItem.ModerateOperationShortName)]
|
||||
[Authorize(Policy = RMuseumSecurableItem.AudioRecitationEntityShortName + ":" + RMuseumSecurableItem.PublishOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(bool))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> RetryPublish()
|
||||
@ -677,7 +705,7 @@ namespace RMuseum.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transfer Recitations Ownership
|
||||
/// Transfer Recitations Ownership (for recitations owned by current user)
|
||||
/// </summary>
|
||||
/// <param name="targetEmailAddress"></param>
|
||||
/// <param name="artistName"></param>
|
||||
|
||||
@ -127,9 +127,10 @@ namespace RMuseum.Models.Auth.Memory
|
||||
Description = "خوانشها",
|
||||
Operations = new SecurableItemOperation[]
|
||||
{
|
||||
new SecurableItemOperation(PublishOperationShortName, "انتشار خوانش خود", false),
|
||||
new SecurableItemOperation(ModerateOperationShortName, "بررسی خوانش کاربران دیگر", false),
|
||||
new SecurableItemOperation(ReOrderOperationShortName, "تغییر ترتیب خوانشها", false),
|
||||
new SecurableItemOperation(ImportOperationShortName, "ورود اطلاعات از منابع خارجی", false),
|
||||
new SecurableItemOperation(ModerateOperationShortName, "بررسی", false),
|
||||
new SecurableItemOperation(ReOrderOperationShortName, "تغییر ترتیب", false),
|
||||
}
|
||||
},
|
||||
new SecurableItem()
|
||||
|
||||
@ -828,7 +828,7 @@
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.ModeratePoemNarration(System.Int32,RMuseum.Models.GanjoorAudio.ViewModels.RecitationModerateViewModel)">
|
||||
<summary>
|
||||
Moderate pending narration
|
||||
Moderate pending narration (for moderating other users' recitations you also need recitation:moderate permission)
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="model"></param>
|
||||
@ -925,7 +925,7 @@
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.RecitationController.TransferRecitationsOwnership(System.String,System.String)">
|
||||
<summary>
|
||||
Transfer Recitations Ownership
|
||||
Transfer Recitations Ownership (for recitations owned by current user)
|
||||
</summary>
|
||||
<param name="targetEmailAddress"></param>
|
||||
<param name="artistName"></param>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user