예제 #1
0
        public void BasicPermissions()
        {
            //Common SHOULD be able read common content
            var entity = service.CanUserDoOnParent(unit.commonContent.id, Services.Constants.Keys.ReadAction, commonRequester).Result;

            //Can't read special
            Task check = service.CanUserDoOnParent(unit.specialContent.id, Services.Constants.Keys.ReadAction, commonRequester);

            AssertWaitThrows <ForbiddenException>(check);

            entity = service.CanUserDoOnParent(unit.specialContent.id, Services.Constants.Keys.ReadAction, specialRequester).Result;
        }
예제 #2
0
 public Task <ActionResult <string> > RunCommand([FromRoute] string name, [FromBody] string arguments, [FromRoute] long parentId)
 {
     return(ThrowToAction(async() =>
     {
         var requester = GetRequesterNoFail();
         //The user MUST be able to create content in the given parent ID in order to run module commands there.
         await moduleMessageService.CanUserDoOnParent(parentId, Services.Constants.Keys.CreateAction, requester);
         string result = null;
         //RunCommand should be thread safe, so just... run it async!
         await Task.Run(() => result = moduleService.RunCommand(name, arguments, requester, parentId));
         return result;
     }));
 }