Exemplo n.º 1
0
        public async Task <bool> DeleteAsync(KeyGrant grant)
        {
            Ensure.NotNull(grant, nameof(grant));

            return(await db.KeyGrants.PatchAsync(grant.Id, new[] {
                Change.Replace("deleted", Expression.Now)
            }, Expression.IsNull("deleted")) > 0);
        }
Exemplo n.º 2
0
        public async Task <KeyGrant> CreateAsync(CreateKeyGrantRequest request)
        {
            Ensure.NotNull(request, nameof(request));

            var grant = new KeyGrant(
                grantId: Guid.NewGuid(),
                keyId: request.KeyId,
                name: request.Name,
                actions: request.Actions,
                userId: request.UserId,
                constraints: request.Constraints,
                externalId: request.ExternalId,
                properties: request.Properties
                );

            await db.KeyGrants.InsertAsync(grant);

            return(grant);
        }