This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var CIListParents = Class.create(); | |
| CIListParents.prototype = { | |
| initialize : function() { | |
| this.maxDepth = gs.getProperty('glide.relationship.max_depth',10); // how deep to look | |
| this.currentDepth = 0; | |
| //this.services = new Object(); // list of affected services | |
| this.services = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Business Rule | |
| Name: relateToChildren | |
| Table: Application Software [cmdb_ci_application_software] | |
| When to Run: Before, Insert and Update | |
| Filter Condition: u_depends_onVALCHANGES^EQ | |
| BETA / Prototype / To-do: Code Clean up. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var myLog = ""; | |
| var gr = new GlideRecord("sys_user"); | |
| //New object to build OR query | |
| var q1 = gr.addQuery("title", "CONTAINS", "VP"); | |
| q1.addOrCondition("title", "CONTAINS", "Vice"); | |
| q1.addOrCondition("title", "CONTAINS", "Chief"); | |
| //"switch back" to the GR object | |
| gr.query(); | |
| while (gr.next()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var CidrUtil = Class.create(); | |
| CidrUtil.prototype = { | |
| initialize: function() { | |
| }, | |
| ipIsInCidr : function(ip, cidr) { | |
| var cidrIp = cidr.split('/')[0]; | |
| var cidrSm = cidr.split('/')[1]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var count = new GlideAggregate('sn_vul_vulnerability'); | |
| count.addAggregate('COUNT'); | |
| //count.addEncodedQuery('state=2'); //State = Under Investigation | |
| count.query(); | |
| var vul_grp = 0; | |
| if (count.next()) { | |
| vul_grp = count.getAggregate('COUNT'); | |
| } | |
| gs.info('Number of VulGrps: ' + vul_grp); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var count = new GlideAggregate('sn_vul_m2m_vul_group_item'); | |
| count.addAggregate('COUNT'); | |
| count.addEncodedQuery('sn_vul_vulnerability=003bc720df11120068c32df36bf263a2'); | |
| count.query(); | |
| var vits = 0; | |
| if (count.next()) { | |
| vits = count.getAggregate('COUNT'); | |
| } | |
| gs.info('Number of vits: ' + vits); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Resolved, Defered, Closed | |
| var count = new GlideAggregate('sn_vul_m2m_vul_group_item'); | |
| count.addAggregate('COUNT'); | |
| count.addEncodedQuery('sn_vul_vulnerable_item.stateIN101,12,3^sn_vul_vulnerability=f52bc720df11120068c32df36bf26384'); | |
| count.query(); | |
| var vits = 0; | |
| if (count.next()) { | |
| vits = count.getAggregate('COUNT'); | |
| } | |
| gs.info('Number of vits: ' + vits); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var VulnerabilityCountUtils = Class.create(); | |
| VulnerabilityCountUtils.prototype = { | |
| initialize: function() { | |
| }, | |
| /* | |
| Usage: | |
| Schedule Job: new VulnerabilityCountUtils().setAllVulGrp(); | |
| UI Action:new VulnerabilityCountUtils().setSingleVulGrp(current.sys_id); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function removeSelectOptions(elementId,removeNone){ | |
| //V3 removeSelectOptions('resolution',true) | |
| //removeNone(true|false) is for: "-- None --" option | |
| var wp = gel(elementId); | |
| var wplen = wp.length; | |
| for(i = 0; i < wplen; i++){ | |
| wp.remove(1); | |
| } | |
| if(removeNone){ | |
| wp.remove(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| answer = (new global.ArrayUtil().contains(before.pluginArr, 'com.snc.vulnerability')); |