public Task <ActionResult <LoadCarrierReceipt> > Post([FromBody] LoadCarrierReceiptsCreateRequest request) { if (request != null && request.DplNote != null && _authData.GetUserRole() == UserRole.DplEmployee) { request.DplNote.UserId = _authData.GetUserId(); } return(this._loadCarrierReceiptsService.Create(request).Convert <LoadCarrierReceipt>(this)); }
public Task<ActionResult<Order>> Patch(int id, [FromBody] OrderUpdateRequest request) { if (request != null && request.DplNote != null && _authData.GetUserRole() == UserRole.DplEmployee) { request.DplNote.UserId = _authData.GetUserId(); } return this._ordersService.Update(id, request).Convert(this); }
public Task <ActionResult <Voucher> > Post([FromBody] VouchersCreateRequest request) { if (request != null && request.DplNote != null && _authData.GetUserRole() == UserRole.DplEmployee) { request.DplNote.UserId = _authData.GetUserId(); } return(this._vouchersService.Create(request).Convert <Voucher>(this)); }
public Task <ActionResult <OrderGroup> > Post([FromBody] OrderGroupsCreateRequest request) { if (request?.DplNote != null && _authData.GetUserRole() == UserRole.DplEmployee) { request.DplNote.UserId = _authData.GetUserId(); } return(this._orderGroupsService.Create(request).Convert <OrderGroup>(this)); }
public Task <ActionResult <PostingRequest> > Post([FromBody] BalanceTransferCreateRequest request) { if (request != null && request.DplNote != null && _authData.GetUserRole() == UserRole.DplEmployee) { request.DplNote.UserId = _authData.GetUserId(); } return(this._balanceTransfersService.Create(request).Convert <PostingRequest>(this)); }
public Task <ActionResult <OrderLoad> > Cancel(int id, OrderLoadCancelRequest request) { if (request != null && request.DplNote != null && _authData.GetUserRole() == UserRole.DplEmployee) { request.DplNote.UserId = _authData.GetUserId(); } return(this._ordersLoadsService.Cancel(id, request).Convert <OrderLoad>(this)); }
public bool HasPermission(PermissionResourceType resource, ResourceAction action, int referenceId) { // skip checking permissions for dpl employees if (_authData.GetUserRole() == UserRole.DplEmployee) { return(true); } // TODO decide if this method should be sync or async // if async we can use the permissions in the distributed cache // they are already inserted individually var userId = _authData.GetUserId(); ImmutableHashSet <string> userPermissions; if (_permissionsCache.TryGetValue(userId, out userPermissions)) { var permissionsKey = GetPermissionKey(userId, resource, action, referenceId); var hasPermission = userPermissions.Contains(permissionsKey); return(hasPermission); } return(false); }