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);
 }
示例#2
0
 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));
 }
示例#3
0
 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));
 }
示例#5
0
 protected BaseService(IAuthorizationDataService authData, IAuthorizationService authService, IMapper mapper)
 {
     AuthData      = authData;
     AuthService   = authService;
     Mapper        = mapper;
     IsDplEmployee = authData.GetUserRole() == Common.Enumerations.UserRole.DplEmployee;
 }
 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));
 }
示例#8
0
        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);
        }