JavaLikeCalc.JavaScript
if(f_start) {
	grpLs = new Array(); userSelVl = lib_value_ = sesUer = "";
	userLbUpdt = userSel = 0;
}

if(sesUer != this.ownerSess().reqUser()) {
	userSel = userLbUpdt = SYS.mtime();
	userSelVl = sesUer = this.ownerSess().reqUser();
}

//Events for commands process
for(ev_rez = "", offEv = 0; (ev_cur=event.parse(0,"\n",offEv)).length; ) {
	//this.messInfo("Event: "+ev_cur);
	if(ev_cur == "ws_ListChange:/lib") {
		userSel = SYS.mtime();
		userSelVl = ((userSelVl=lib_value.match("\\((.+)\\)$")).length > 1) ? userSelVl[1] : "";
	}
	if(ev_cur == "ws_BtPress:/userAdd") {
		if(!userNm_value.length) userNm_value = tr("NewUser");
		req = SYS.XMLNode("add").setAttr("path","/sub_Security/%2fbr%2fusr_").setText(userNm_value);
		if(!SYS.cntrReq(req).toInt()) {
			userNm_value = req.text();
			if(storeDB.length)
				SYS.cntrReq(SYS.XMLNode("set").setAttr("path","/sub_Security/"+userNm_value+"/%2fprm%2fdb").setText(storeDB));
			for(off = 0; (iIt=newUseGrps.parse(0,";",off)).length; )
				if((oIt=SYS.Security.nodeAt("grp_"+iIt)))
					oIt.cfgSet("USERS", oIt.cfg("USERS")+userNm_value+";");
			lib_value_ = userNm_value+" ("+userNm_value+")"; userSelVl = userNm_value;
			userLbUpdt = userSel = SYS.mtime()+500;

			SYS.messNote("OP:"+this.ownerSess().user()+":{Page}."+this.attr("id"), title_text+" : "+tr("Added user \"%1\"").replace("%1",userNm_value));
		}

		SYS.cntrReq(SYS.XMLNode("save").setAttr("path","/sub_Security/%2fobj"));	//To save all users and groups
	}
	else if(ev_cur == "dlg_Apply:/userDel" && userSelVl.length) {
		req = SYS.XMLNode("del").setAttr("path","/sub_Security/%2fbr%2fusr_").setText(userSelVl);
		rez = SYS.cntrReq(req);
		SYS.messNote("OP:"+this.ownerSess().user()+":{Page}."+this.attr("id"), title_text+" : "+tr("Deleted user \"%1\"").replace("%1",userNm_value));
		//this.messInfo("Result: "+rez+": "+req.save());
		lib_value_ = userSelVl = "";
		userLbUpdt = userSel = SYS.mtime()+500;

		SYS.cntrReq(SYS.XMLNode("save").setAttr("path","/sub_Security/%2fobj"));	//To save all groups
	}
	else if(ev_cur == "ws_LnAccept:/fullName" && (oIt=SYS.Security.nodeAt("usr_"+userSelVl))) {
		oIt.cfgSet("DESCR", fullName_value);
		SYS.cntrReq(SYS.XMLNode("save").setAttr("path","/sub_Security/usr_"+userSelVl+"/%2fobj"));
		SYS.messNote("OP:"+this.ownerSess().user()+":{Page}."+this.attr("id"), title_text+" : "+tr("Set the user \"%1\" for").replace("%1",userSelVl)+" "+tr("Full name")+" : : "+fullName_value);
		lib_value_ = fullName_value + " ("+userSelVl+")";
		userLbUpdt = userSel = SYS.mtime()+500;
	}
	else if(ev_cur == "ws_TxtAccept:/descr" && (oIt=SYS.Security.nodeAt("usr_"+userSelVl))) {
		oIt.cfgSet("LONGDESCR", descr_value);
		SYS.cntrReq(SYS.XMLNode("save").setAttr("path","/sub_Security/usr_"+userSelVl+"/%2fobj"));
		SYS.messNote("OP:"+this.ownerSess().user()+":{Page}."+this.attr("id"), title_text+" : "+tr("Set the user \"%1\" for").replace("%1",userSelVl)+" "+tr("Description")+" : : "+descr_value);
		userSel = SYS.mtime()+500;
	}
	else if(ev_cur == "ws_LnAccept:/pass" && (oIt=SYS.Security.nodeAt("usr_"+userSelVl))) {
		oIt.cfgSet("PASS", pass_value);
		SYS.cntrReq(SYS.XMLNode("save").setAttr("path","/sub_Security/usr_"+userSelVl+"/%2fobj")); 
		SYS.messNote("OP:"+this.ownerSess().user()+":{Page}."+this.attr("id"), title_text+" : "+tr("Set the user \"%1\" for").replace("%1",userSelVl)+" "+tr("Password")+" : : "+tr("CHANGED"));
		userSel = SYS.mtime()+500;
	}
	else if(ev_cur == "ws_TableChangeSel:/grp" && (oIt=SYS.Security.nodeAt("usr_"+userSelVl)) &&
			grp_value.length && (oIt1=SYS.Security.nodeAt(grp_value))) {
		grp_value = grp_value.slice(4);
		SYS.messNote("OP:"+this.ownerSess().user()+":{Page}."+this.attr("id"), title_text+" : "+tr("Set the user \"%1\" for").replace("%1",userSelVl)+" "+(oIt1.user(userSelVl)?tr("Group uncheck"):tr("Group check"))+" : : "+grp_value);
		users = oIt1.cfg("USERS");
		//this.messInfo("grp_value="+grp_value+"; users="+users);
		oIt1.cfgSet("USERS", oIt1.user(userSelVl) ? users.replace(userSelVl+";","") : users+userSelVl+";");
		SYS.cntrReq(SYS.XMLNode("save").setAttr("path","/sub_Security/usr_"+userSelVl+"/%2fobj")); 
		userSel = SYS.mtime()+500;
	}
	else ev_rez += (ev_cur+"\n");
}
event = ev_rez;

//Get users and groups list
if(f_start || (userLbUpdt && SYS.mtime() >= userLbUpdt)) {
	userLbUpdt = 0;
	rez = SYS.Security.nodeList("usr_");
	//rez = SYS.BD.nodeAt(dbDB,".").SQLReq("SELECT name FROM "+dbProgs+";");
	lib_items = userNm_cfg = "";
	for(iIt = 0; iIt < rez.length; iIt++) {
		if(denyUsers.indexOf(rez[iIt].slice(4)) >= 0 || !(oIt=SYS.Security.nodeAt(rez[iIt])))	continue;
		tVl1 = ((tVl=oIt.cfg("DESCR")).length?tVl:rez[iIt].slice(4)) + " ("+rez[iIt].slice(4)+")";
		lib_items += (lib_items.length?"\n":"") + tVl1;
		userNm_cfg += (userNm_cfg.length?"\n":"") + rez[iIt].slice(4);
		if(userSelVl == rez[iIt].slice(4))	lib_value_ = tVl1;
	}
	lib_value = lib_value_;

	grpLs = SYS.Security.nodeList("grp_");
	for(iL = 0; iL < grpLs.length; iL++)
		if(denyGroups.indexOf(grpLs[iL].slice(4)) >= 0)
		{ grpLs.splice(iL, 1); iL--; }
}
userDel_active = userSelVl.length;

if(userSel && SYS.mtime() >= userSel) {
	userSel = 0;
	fullName_active = descr_active = pass_active = grp_active = false;
	name_value = fullName_value = descr_value = pass_value = grp_items = "";

	if(userSelVl.length && (oIt=SYS.Security.nodeAt(userSelVl))) {
		//this.messInfo("userSelVl="+userSelVl);
		fullName_active = descr_active = pass_active = grp_active = true;
		name_value = oIt.cfg("NAME");
		fullName_value = oIt.cfg("DESCR");
		descr_value = oIt.cfg("LONGDESCR");
		pass_value = oIt.cfg("PASS");
		//Groups
		grp_items = "<tbl sel='row' colsWdthFit='1' vHdrVis='0' hHdrVis='0' keyID='0'>\n"
			"<h><s width='0'>Ідентифікатор</s><s>Група</s></h>\n";
		for(iIt = 0; iIt < grpLs.length; iIt++) {
			if(!(oIt=SYS.Security.nodeAt(grpLs[iIt])))	continue;
			grp_items += "<r"+(oIt.user(userSelVl)?" color='#777799'":"")+">"
				"<s>"+SYS.strEncode(grpLs[iIt],"HTML")+"</s>"
				"<s>"+SYS.strEncode(oIt.cfg("DESCR")+" ("+grpLs[iIt].slice(4)+")","HTML")+"</s></r>";
		}
		grp_items += "</tbl>";
		grp_value = "";
	}
}