@JGStew

My random thoughts.


Takeaction Using Javascript + Relevance Bigfix Console

Note: this post has some formatting issues due to it being pulled from existing HTML.

It is possible to use JavaScript + Relevance within the BigFix Windows Console to customize behavior of Fixlets / Tasks and other content.

 

One example is to prevent the console user from "Taking Action" on a Fixlet or Task, unless certain criteria are met.

  • document.body.ontakeaction
    • allows JavaScript to be executed when the "Take Action" button is clicked in the console.
      • Can be used to prevent the "Take Action" from continuing. 

Some potential use cases for preventing "Take Action" on a Fixlet or Task:

  • Only allow certain users to "Take Action"
    • Some actions may be managed by a central group and duplicate actions should not be taken by other operators, even if they have read access to the site.
    • Users could be authorized explicitly, or based upon role, or other criteria.
    • if ("NormalUser1" == Relevance('name of current console user') || Relevance('exists current console user whose(master flag of it)'))
    • if ( Relevance('(master flag of current console user) OR ( /* Make sure the user has at least one of the roles */  1 is less than or equal to the number of elements of intersections of (set of bes roles whose(name of it = "ROLE1" OR name of it = "ROLE2"); role set of current console user))') )
  • Only allow users that are writers to the site the fixlet resides in to "Take Action"
    • Example: Template tasks that are not meant to be run directly, but copied and modified by the user before use.
    • Relevance('exists writers whose(it = current console user) of site of current fixlet')

 

Full JavaScript + Relevance Example:

document.body.ontakeaction = function() { 
	if ( "NormalUser1" == Relevance('name of current console user') || Relevance('(master flag of current console user) OR ( /* Make sure the user has at least one of the roles */ 1 is less than or equal to the number of elements of intersections of (set of bes roles whose(name of it = "ROLE1" OR name of it = "ROLE2"); role set of current console user))') ) 
	{ 
		TakeFixletAction( Relevance('id of current fixlet'), Relevance('id of current bes site'), "Action1", {}, {} ); 
	} else {
		alert( "Only for authorized users, please contact support for assistance." ); 
	}
	return false; 
}

 

Steps:

1. Create or Edit content </img>
2. Click the add script button </img>
3. Paste the JavaScript modified as needed </img>
4. Click the "OK" button to save script </img>
5. Make any further changes to the content </img>
6. Click the "OK" button to save content </img>

 

 

References:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014849827

http://bigfix.me/relevance/details/2999187

https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Tivoli%20Endpoint%20Manager/page/Console%20JavaScript%20Events

Example: http://bigfix.me/fixlet/details/3876