//用X++得到当前用户是否有某Security Key的权限级别,完整Job演示 static void xyf_checkSecurity(Args _args) { DictSecurityKey _dictSkey = new DictSecurityKey(securitykeynum(CustTables)); DictEnum _dictEnum = new DictEnum(enumnum(AccessType)); str 50 left st; int i; AccessType fkeyAccess; ; fkeyAccess = _dictSkey.rights(); //返回该表的安全Key等级权限int或者AccessType类型 print _dictSkey.name(); print _dictSkey.id(); print _dictSkey.configurationKeyId(); print _dictSkey.label(); print _dictSkey.parentSecurityKeyId(); print fkeyAccess; print _dictEnum.value2Symbol(fkeyAccess); print _dictEnum.symbol2Value('delete'); print _dictEnum.index2Name(fkeyAccess); i = _dictEnum.values();//5个枚举值 print 'The Enum of "AccessType" have ',i, ' elements'; while(i) { print ' the ' ,i, ' of ',_dictEnum.value2Name(i); i--; } print 'Current SecurityKey Number have ' , _dictEnum.name2Value(_dictEnum.value2Symbol(fkeyAccess)); for(i = 1 ; i <= _dictEnum.name2Value(_dictEnum.value2Symbol(fkeyAccess)); i++) { if(!st) st = _dictEnum.value2Label(i); else st += ',' + _dictEnum.value2Label(i); } info("You are have some SecurityKey of '" + st + "'"); if (fkeyAccess < AccessType::Edit) { info('You do not have edit right'); } else info('you have edit right'); pause; }