@Test public void testHasAddOrRemovePermissionForNonAdminSuccessfully() { UserDetails userDetails = getMockUser(false); userDetails.setUsername(ADMIN_USER); SSLCertificateMetadataDetails certificateMetadata = getSSLCertificateMetadataDetails(); boolean canAdd = certificateUtils.hasAddOrRemovePermission(userDetails, certificateMetadata); assertTrue(canAdd); }
public boolean hasAddOrRemovePermission(UserDetails userDetails, SSLCertificateMetadataDetails certificateMetaData) { if (ObjectUtils.isEmpty(certificateMetaData)) { return false; } if (userDetails.isAdmin()) { return checkIfCertificateAdmin(userDetails, certificateMetaData); } else { return checkIfNonCertificateAdmin(userDetails, certificateMetaData); } }
CertificateUtils { public boolean hasAddOrRemovePermission(UserDetails userDetails, SSLCertificateMetadataDetails certificateMetaData) { if (ObjectUtils.isEmpty(certificateMetaData)) { return false; } if (userDetails.isAdmin()) { return checkIfCertificateAdmin(userDetails, certificateMetaData); } else { return checkIfNonCertificateAdmin(userDetails, certificateMetaData); } } }
CertificateUtils { public boolean hasAddOrRemovePermission(UserDetails userDetails, SSLCertificateMetadataDetails certificateMetaData) { if (ObjectUtils.isEmpty(certificateMetaData)) { return false; } if (userDetails.isAdmin()) { return checkIfCertificateAdmin(userDetails, certificateMetaData); } else { return checkIfNonCertificateAdmin(userDetails, certificateMetaData); } }  }
CertificateUtils { public boolean hasAddOrRemovePermission(UserDetails userDetails, SSLCertificateMetadataDetails certificateMetaData) { if (ObjectUtils.isEmpty(certificateMetaData)) { return false; } if (userDetails.isAdmin()) { return checkIfCertificateAdmin(userDetails, certificateMetaData); } else { return checkIfNonCertificateAdmin(userDetails, certificateMetaData); } }  boolean hasAddOrRemovePermission(UserDetails userDetails, SSLCertificateMetadataDetails certificateMetaData); SSLCertificateMetadataDetails getCertificateMetaData(String token, String certificateName, String certificateType); }
CertificateUtils { public boolean hasAddOrRemovePermission(UserDetails userDetails, SSLCertificateMetadataDetails certificateMetaData) { if (ObjectUtils.isEmpty(certificateMetaData)) { return false; } if (userDetails.isAdmin()) { return checkIfCertificateAdmin(userDetails, certificateMetaData); } else { return checkIfNonCertificateAdmin(userDetails, certificateMetaData); } }  boolean hasAddOrRemovePermission(UserDetails userDetails, SSLCertificateMetadataDetails certificateMetaData); SSLCertificateMetadataDetails getCertificateMetaData(String token, String certificateName, String certificateType);  }