Tivoli Identity Manager调用脚本输出日志.

来源:互联网 发布:方立勋java web 编辑:程序博客网 时间:2024/06/06 02:46

在tim的采纳和供应策略里面可以配置参数.

如果是js的,可以调用自带方法打印错误和状态:

下面是一个例子的实例,可以参考.

 

 

var entryUid = subject.eruid[0];Enrole.log("script", "Starting script for eruid=" + entryUid);/* change following value to the name of the master service: *//* var masterServiceName = "Master AD Service";*/var masterServiceName = "NT4 (local)";var scriptResult = null;var personsearch = new PersonSearch();var filter = "(eraliases=" + entryUid + ")";var psResult = personsearch.searchByFilter("", filter,2);if (psResult.length == 1) {/* found one person with matching alias */Enrole.log("script", "single match for eraliases=" + entryUid);scriptResult = psResult;}else if (psResult.length > 1) {/* more than one person matched alias. * if the account has a "cn" attribute value, see if this matches the "cn" of one of them */Enrole.log("script", "multiple matchs for eraliases=" + entryUid);var entryCn = subject.cn;if (typeof entryCn != "undefined") {Enrole.log("script", "checking cn=" + entryCn[0]);for (idx=0; idx<psResult.length; ++idx) {var cn1 = psResult[idx].getProperty("cn");if (cn1.length != 0 && cn1[0] == entryCn[0]) {/* we found a match for the cn */scriptResult = psResult[idx];break;}}}else {Enrole.log("script", "cn field not defined for eruid=" + entryUid);}}else {/* no person matched specified alias.    See if there is a matching account uid in the company Active Directory */var acctSearch = new AccountSearch();var asResult = acctSearch.searchByUidAndService(entryUid, masterServiceName);if (asResult != null && asResult.length == 1) {/* found a matching AD account -- use this accounts owner, if it isn't an orphan */var owner = asResult[0].getProperty("owner");if (owner.length == 1) {var owner_dn = owner[0];Enrole.log("script", "single match for service " + masterServiceName + " uid="        + entryUid + ", returning person with dn=" + owner_dn);scriptResult = new Person(owner_dn);}else {Enrole.log("script", "service " + masterServiceName + " uid="        + entryUid + " is an orphan");}}else {Enrole.log("script", "No match or more than one match for uid=" + entryUid      + " on master service " + masterServiceName);}}return scriptResult;/* end of script */ 
Note: Log messages are written to the message log using the script category.

 

Enrole打印出来的都是error级别.