/** * Get the status of SCAP detailed result file upload settings for the given organization. * * @param sessionKey User's session key. * @param orgId ID of organization to query. * @return Returns the status of SCAP detailed result file upload settings. * @xmlrpc.doc Get the status of SCAP detailed result file upload settings for the given * organization. * @xmlrpc.param #session_key() * @xmlrpc.param #param("int", "orgId") * @xmlrpc.returntype #struct("scap_upload_info") #prop_desc("boolean", "enabled", "Aggregation of * detailed SCAP results is enabled.") #prop_desc("int", "size_limit", "Limit (in Bytes) for a * single SCAP file upload.") #struct_end() */ public Map<String, Object> getPolicyForScapFileUpload(String sessionKey, Integer orgId) { getSatAdmin(sessionKey); Org org = verifyOrgExists(orgId); Map<String, Object> result = new HashMap<String, Object>(); result.put("enabled", org.getOrgConfig().isScapfileUploadEnabled()); result.put("size_limit", org.getOrgConfig().getScapFileSizelimit()); return result; }
public void testStagingContent() throws Exception { Org org1 = createTestOrg(); boolean staging = org1.getOrgConfig().isStagingContentEnabled(); Long id = org1.getId(); org1.getOrgConfig().setStagingContentEnabled(!staging); OrgFactory.save(org1); assertEquals(!staging, org1.getOrgConfig().isStagingContentEnabled()); flushAndEvict(org1); Org org2 = OrgFactory.lookupById(id); assertEquals(!staging, org2.getOrgConfig().isStagingContentEnabled()); }
/** * Set the status of crash file upload settings for the given organization. * * @param sessionKey User's session key. * @param orgId Organization ID to set the limit for. * @param enable Boolean to indicate desired settings. * @return Returns 1 for successfull change, 0 if the change failed. * @xmlrpc.doc Set the status of crash file upload settings for the given organization. Modifying * the settings is possible as long as crash reporting is enabled. * @xmlrpc.param #param("string", "sessionKey") * @xmlrpc.param #param("int", "orgId") * @xmlrpc.param #param_desc("boolean", "enable", "Use true/false to enable/disable") * @xmlrpc.returntype #return_int_success() */ public Integer setCrashfileUpload(String sessionKey, Integer orgId, Boolean enable) { getSatAdmin(sessionKey); Org org = verifyOrgExists(orgId); if (org.getOrgConfig().isCrashReportingEnabled()) { org.getOrgConfig().setCrashfileUploadEnabled(enable); } else { return 0; } return 1; }
/** * Get the status of SCAP result deletion settings for the given organization. * * @param sessionKey User's session key. * @param orgId ID of organization to query. * @return Returns the status of SCAP result deletion settings. * @xmlrpc.doc Get the status of SCAP result deletion settings for the given organization. * @xmlrpc.param #session_key() * @xmlrpc.param #param("int", "orgId") * @xmlrpc.returntype #struct("scap_deletion_info") #prop_desc("boolean", "enabled", "Deletion of * SCAP results is enabled") #prop_desc("int", "retention_period", "Period (in days) after * which a scan can be deleted (if enabled).") #struct_end() */ public Map<String, Object> getPolicyForScapResultDeletion(String sessionKey, Integer orgId) { getSatAdmin(sessionKey); Org org = verifyOrgExists(orgId); Long retentionPeriod = org.getOrgConfig().getScapRetentionPeriodDays(); Map<String, Object> result = new HashMap<String, Object>(); result.put("enabled", retentionPeriod != null); result.put("retention_period", (retentionPeriod != null) ? retentionPeriod : new Long(0)); return result; }
/** * Set organization wide crash file size limit. * * @param sessionKey User's session key. * @param orgId Organization ID to set the limit for. * @param limit The limit to set. * @return 1 on success. * @xmlrpc.doc Set the organization wide crash file size limit. The limit value must be * non-negative, zero means no limit. * @xmlrpc.param #param("string", "sessionKey") * @xmlrpc.param #param("int", "orgId") * @xmlrpc.param #param_desc("int", "limit", "The limit to set (non-negative value).") * @xmlrpc.returntype #return_int_success() */ public int setCrashFileSizeLimit(String sessionKey, Integer orgId, Integer limit) { getSatAdmin(sessionKey); Org org = verifyOrgExists(orgId); if (limit < 0) { throw new InvalidParameterException("Limit value must be non-negative."); } org.getOrgConfig().setCrashFileSizelimit(new Long(limit.longValue())); return 1; }
/** * Get the status of crash file upload settings for the given organization. * * @param sessionKey User's session key. * @param orgId Organization ID to set the limit for. * @return Returns the status of crash file upload settings. * @xmlrpc.doc Get the status of crash file upload settings for the given organization. Returns * true if enabled, false otherwise. * @xmlrpc.param #param("string", "sessionKey") * @xmlrpc.param #param("int", "orgId") * @xmlrpc.returntype boolean - Get the status of crash file upload settings. */ public boolean isCrashfileUploadEnabled(String sessionKey, Integer orgId) { getSatAdmin(sessionKey); Org org = verifyOrgExists(orgId); return org.getOrgConfig().isCrashfileUploadEnabled(); }
/** * Get organization wide crash file size limit. * * @param sessionKey User's session key. * @param orgId Organization ID to set the limit for. * @return Returns the organization wide crash file size limit. * @xmlrpc.doc Get the organization wide crash file size limit. The limit value must be a * non-negative number, zero means no limit. * @xmlrpc.param #param("string", "sessionKey") * @xmlrpc.param #param("int", "orgId") * @xmlrpc.returntype int - Crash file size limit. */ public int getCrashFileSizeLimit(String sessionKey, Integer orgId) { getSatAdmin(sessionKey); Org org = verifyOrgExists(orgId); return org.getOrgConfig().getCrashFileSizelimit().intValue(); }