DBService implements RolesProvider { public DomainRoleMembers listOverdueReviewRoleMembers(String domainName) { try (ObjectStoreConnection con = store.getConnection(true, false)) { return con.listOverdueReviewRoleMembers(domainName); } } DBService(ObjectStore store, AuditLogger auditLogger, ZMSConfig zmsConfig, AuditReferenceValidator auditReferenceValidator); DomainRoleMembers listOverdueReviewRoleMembers(String domainName); @Override List<Role> getRolesByDomain(String domain); ResourceAccessList getResourceAccessList(String principal, String action); AthenzDomain getAthenzDomain(final String domainName, boolean masterCopy); Quota getQuota(String domainName); void executePutRoleSystemMeta(ResourceContext ctx, final String domainName, final String roleName,
           RoleSystemMeta meta, final String attribute, final String auditRef, final String caller); void executePutGroupSystemMeta(ResourceContext ctx, final String domainName, final String groupName,
                                          GroupSystemMeta meta, final String attribute, final String auditRef); void executePutServiceIdentitySystemMeta(ResourceContext ctx, String domainName, String serviceName,
            ServiceIdentitySystemMeta meta, String attribute, String auditRef, String caller); void executePutRoleMeta(ResourceContext ctx, String domainName, String roleName, Role originalRole,
                                   RoleMeta meta, String auditRef, String caller); void executePutGroupMeta(ResourceContext ctx, final String domainName, final String groupName,
                                    GroupMeta meta, final String auditRef); Set<String> getPendingMembershipApproverRoles(int delayDays); Set<String> getPendingGroupMembershipApproverRoles(int delayDays); Map<String, DomainRoleMember> getRoleExpiryMembers(int delayDays); Map<String, DomainRoleMember> getRoleReviewMembers(int delayDays); Map<String, DomainGroupMember> getGroupExpiryMembers(int delayDays); void processExpiredPendingMembers(int pendingRoleMemberLifespan, final String monitorIdentity); void processExpiredPendingGroupMembers(int pendingGroupMemberLifespan, final String monitorIdentity); static int AUDIT_TYPE_ROLE; static int AUDIT_TYPE_POLICY; static int AUDIT_TYPE_SERVICE; static int AUDIT_TYPE_DOMAIN; static int AUDIT_TYPE_ENTITY; static int AUDIT_TYPE_TENANCY; static int AUDIT_TYPE_TEMPLATE; static int AUDIT_TYPE_GROUP; }
@Test public void testListOverdueReviewRoleMembers() { final String domainName1 = "test-domain1"; List<String> admins = new ArrayList<>(); admins.add(adminUser); zms.dbService.makeDomain(mockDomRsrcCtx, ZMSTestUtils.makeDomainObject(domainName1, "test desc", "org", false, "", 1996, "", 0), admins, null, auditRef); long currentTimeMillis = System.currentTimeMillis(); Timestamp oldTimestamp = Timestamp.fromMillis(currentTimeMillis - 60000); Timestamp futureTimestamp = Timestamp.fromMillis(currentTimeMillis + 60000); List<RoleMember> roleMembers = new ArrayList<>(); roleMembers.add(new RoleMember().setMemberName("user.overduereview1").setReviewReminder(oldTimestamp)); roleMembers.add(new RoleMember().setMemberName("user.overduereview2").setReviewReminder(oldTimestamp)); roleMembers.add(new RoleMember().setMemberName("user.futurereview1").setReviewReminder(futureTimestamp)); roleMembers.add(new RoleMember().setMemberName("user.noreview1")); Role role = createRoleObject(domainName1, "role1", null, roleMembers); zms.dbService.executePutRole(mockDomRsrcCtx, domainName1, "role1", role, "test", "putrole"); DomainRoleMembers responseMembers = zms.dbService.listOverdueReviewRoleMembers(domainName1); assertEquals("test-domain1", responseMembers.getDomainName()); List<DomainRoleMember> responseRoleMemberList = responseMembers.getMembers(); assertEquals(responseRoleMemberList.size(), 2); assertEquals(responseRoleMemberList.get(0).getMemberName(), "user.overduereview1"); assertEquals(responseRoleMemberList.get(1).getMemberName(), "user.overduereview2"); zms.dbService.executeDeleteDomain(mockDomRsrcCtx, domainName1, auditRef, "deletedomain"); }