DBService implements RolesProvider { void auditLogRoleMeta(StringBuilder auditDetails, Role role, String roleName) { auditDetails.append("{\"name\": \"").append(roleName) .append("\", \"selfServe\": \"").append(role.getSelfServe()) .append("\", \"memberExpiryDays\": \"").append(role.getMemberExpiryDays()) .append("\", \"serviceExpiryDays\": \"").append(role.getServiceExpiryDays()) .append("\", \"tokenExpiryMins\": \"").append(role.getTokenExpiryMins()) .append("\", \"certExpiryMins\": \"").append(role.getCertExpiryMins()) .append("\", \"memberReviewDays\": \"").append(role.getMemberReviewDays()) .append("\", \"serviceReviewDays\": \"").append(role.getServiceReviewDays()) .append("\", \"reviewEnabled\": \"").append(role.getReviewEnabled()) .append("\", \"notifyRoles\": \"").append(role.getNotifyRoles()) .append("\", \"signAlgorithm\": \"").append(role.getSignAlgorithm()) .append("\", \"userAuthorityFilter\": \"").append(role.getUserAuthorityFilter()) .append("\", \"userAuthorityExpiration\": \"").append(role.getUserAuthorityExpiration()) .append("\"}"); } 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 testAuditLogRoleMeta() { StringBuilder auditDetails = new StringBuilder(); Role role = new Role().setName("dom1:role.role1").setSelfServe(true).setReviewEnabled(false); zms.dbService.auditLogRoleMeta(auditDetails, role, "role1"); assertEquals(auditDetails.toString(), "{\"name\": \"role1\", \"selfServe\": \"true\", \"memberExpiryDays\": \"null\"," + " \"serviceExpiryDays\": \"null\", \"tokenExpiryMins\": \"null\"," + " \"certExpiryMins\": \"null\", \"memberReviewDays\": \"null\", \"serviceReviewDays\": \"null\"," + " \"reviewEnabled\": \"false\", \"notifyRoles\": \"null\", \"signAlgorithm\": \"null\"," + " \"userAuthorityFilter\": \"null\", \"userAuthorityExpiration\": \"null\"}"); }