public ActionResult <UserFavouriteWorkSpaceDTO> GetUserFavouritesRooms([FromRoute] string id)
        {
            var rid = (HttpContext.User.Identity as ClaimsIdentity).FindFirst("userId").Value;

            if (rid != id || !_acs.IsAdmin(id))   //@TODO Move method into acs
            {
                return(Forbid());
            }
            var res = Service.GetUserFavouriteWorkSpace(id);

            if (res == null)
            {
                return(NotFound());
            }
            return(new OkObjectResult(res));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Can Delete
 /// </summary>
 /// <param name="id">String id</param>
 /// <param name="tid">String tid</param>
 /// <returns>acs Is Admin(id)</returns>
 protected override bool CanDelete(string id, string tid)
 => _acs.IsAdmin(id);
Exemplo n.º 3
0
 /// <summary>
 /// Read All
 /// </summary>
 /// <param name="id">string id</param>
 /// <returns>id Admin</returns>
 protected override bool CanReadAll(string id)
 => _acs.IsAdmin(id);
Exemplo n.º 4
0
 public void RoleIsAdmin()
 {
     SetClaims(Role, Admin);
     _accessControlService.IsAdmin().Should().BeTrue();
 }
 /// <summary>
 /// Can Create
 /// </summary>
 /// <param name="id"></param>
 /// <param name="model"></param>
 /// <returns></returns>
 protected override bool CanCreate(string id, Building model)
 => _acs.IsAdmin(id);