Documentation for Axxon PSIM 1.0.0-1.0.1.

Previous page Examples of scripts with Macros  Examples of scripts with Incident server and Incident manager Next page


Creating test users

On macro 101, create 50 users in Axxon PSIM with IDs from 100 to 150, assigning them an access level with ID 1 (provided that the access level is assigned to the department to which the users are added and users inherit the department access level) and linking an access card with a number, equal to the user ID. The card number must be in HEX format. The department must have no more than 30 users (to speed up the adding process).

Note

For more information on access levels and access cards, see the ACFA PSIM documentation in the AxxonSoft documentation repository.

If an ACS integration is configured in Axxon PSIM, which supports dynamic user recording, then the created user will be automatically written to the ACS controller when the CORE||UPDATE_OBJECT|objtype<PERSON> event is sent. If dynamics is not supported, then recording users to the controller will need to be initiated manually.


dep=10; // department ID
start=100;// first user ID
last=150; // last user ID
acc_lev=1; // access level ID 
dep_count=30; // max number of users in the department

if( Event.SourceType == "MACRO" && Event.Action == "RUN" && Event.SourceId=="101")
 {    
	kol=0;
	card_count=0;
	NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<DEPARTMENT>,objid<"+dep+">");
	for (i=start;i<=last;i++)
	{
		kol++;
		card_count++;
		card=decToHex(card_count);
		if (card[card.length-1]==0) 
		{	
			card_count++;
			card=decToHex(card_count);	
		}
					
		if (kol==dep_count) 
		{						
			NotifyEventStr("CORE","","UPDATE_OBJECT", "objtype<PERSON>,objid<"+i+">,name<user"+i+">,parent_id<"+dep+">, level_id<"+acc_lev+">, facility_code<0>, card<"+card+">");
			kol=0;
			dep++;
			NotifyEventStr("CORE","","UPDATE_OBJECT","objtype<DEPARTMENT>,objid<"+dep+">");
		}
		else
		{
			NotifyEventStr("CORE","","UPDATE_OBJECT", "objtype<PERSON>,objid<"+i+">,name<user"+i+">,parent_id<"+dep+">,level_id<"+acc_lev+">, facility_code<0>,card<"+card+">");
		}
        Sleep(10);
	}
 }
 
function decToHex(n)
{ 
 return Number(n).toString(16); 
}


  • No labels