Exemplo n.º 1
0
        public async Task RemovePermissionForResource(IBaseEntity resource)
        {
            var resourceName = resource.GetPermissionIdentifier();

            if (resourceName == null)
            {
                return;
            }

            var permissions = await alexandriaContext.Permissions.Where(p =>
                                                                        Microsoft.EntityFrameworkCore.EF.Functions.Like(p.ARN, $"{resourceName}::{resource.Id.ToString()}::%"))
                              .ToListAsync();

            this.alexandriaContext.Permissions.RemoveRange(permissions);
        }