static void Esh_FindTablesFromSecKey(Args _args)
{
// The name of the Security key to be specified here
str secKeyName = "smmCRM";
Dictionary dictionary = new Dictionary();
SecurityKeyId secKeyId = dictionary.securityKeyName2Id(secKeyName);
TableId tableId;
DictSecurityKey dictSecurityKey;
DictTable dictTable;
container keyIds;
int i;
;
if (secKeyId)
{
// Find all children of the specified Security key
for (i = dictionary.securityKeyNext(0); i; i = dictionary.securityKeyNext(i))
{
dictSecurityKey = new DictSecurityKey(i);
while (dictSecurityKey.parentSecurityKeyId())
dictSecurityKey = new DictSecurityKey(dictSecurityKey.parentSecurityKeyId());
if (dictSecurityKey.id() == secKeyId)
keyIds += i;
}
// Find all tables that have an appropriate Security key
i = 0;
for (tableId = dictionary.tableNext(0);tableId;tableId = dictionary.tableNext(tableId))
{
dictTable = new DictTable(tableId);
if (!dictTable.isMap() && !dictTable.isTmp() && !dictTable.isView())
{
if (confind(keyIds, dictTable.securityKeyId()))
{
i++;
info(dictTable.name());
}
}
}
}
info(strfmt("%1 tables have Security key '%2'", i, secKeyName));
}
{
// The name of the Security key to be specified here
str secKeyName = "smmCRM";
Dictionary dictionary = new Dictionary();
SecurityKeyId secKeyId = dictionary.securityKeyName2Id(secKeyName);
TableId tableId;
DictSecurityKey dictSecurityKey;
DictTable dictTable;
container keyIds;
int i;
;
if (secKeyId)
{
// Find all children of the specified Security key
for (i = dictionary.securityKeyNext(0); i; i = dictionary.securityKeyNext(i))
{
dictSecurityKey = new DictSecurityKey(i);
while (dictSecurityKey.parentSecurityKeyId())
dictSecurityKey = new DictSecurityKey(dictSecurityKey.parentSecurityKeyId());
if (dictSecurityKey.id() == secKeyId)
keyIds += i;
}
// Find all tables that have an appropriate Security key
i = 0;
for (tableId = dictionary.tableNext(0);tableId;tableId = dictionary.tableNext(tableId))
{
dictTable = new DictTable(tableId);
if (!dictTable.isMap() && !dictTable.isTmp() && !dictTable.isView())
{
if (confind(keyIds, dictTable.securityKeyId()))
{
i++;
info(dictTable.name());
}
}
}
}
info(strfmt("%1 tables have Security key '%2'", i, secKeyName));
}
No comments:
Post a Comment