public void RemoveRolesTest()
        {
            cache.AddRole("resouce:operation", "operator");
            cache.AddRole("resouce:operation", "admin");

            Assert.AreEqual(2, cache.GetRoles("resouce:operation").Count);

            cache.RemoveRoles("resouce:operation");

            Assert.AreEqual(0, cache.GetRoles("resouce:operation").Count);
        }
Esempio n. 2
0
        async Task IIamProvider.RemoveRoles(string policyName, IIamProviderCache cache)
        {
            var policyId = await CreateOrGetPolicy(policyName);

            var iamRoles = await _context.IamPolicyRoles
                           .Where(x => x.PolicyId.Equals(policyId))
                           .ToListAsync();

            _context.IamPolicyRoles.RemoveRange(iamRoles);

            await _context.SaveChangesAsync();

            cache.RemoveRoles(policyName);
        }
        Task IIamProvider.RemoveRoles(string policyName, IIamProviderCache cache)
        {
            cache.RemoveRoles(policyName);

            return(Task.CompletedTask);
        }