AXForum  
Вернуться   AXForum > Microsoft Dynamics AX (Axapta) > DAX: За рубежом > DAX in English
Зарегистрироваться Правила Справка Пользователи Блоги Сообщения за день Поиск Все разделы прочитаны Проекты Забыли пароль?

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.03.2009, 19:55  Ссылка на сообщение   #1  
em# is offline
em#
Участник
 
6 / 11 (1) +
Регистрация: 29.05.2008
Setting Security for Temporary Tables without Modifinh the application

Hi!

Temporary tables are not shown in the security tree for assigning permissions, so it's not possible to enable them for users.
In order to make possible to set permissions to a temporary table I modified the SysDictTable class.

boolean allowSecuritySetup()
{
if (//this.isTmp()|| //Temporarily commented in order to show Temp tables in the Tree

this.isMap() ||
this.isView() ||
!this.securityKeyId() || //If not, the table rights cannot be calculated if the user is a member of >1 group
(this.configurationKeyId() && !isConfigurationkeyEnabled(this.configurationKeyId())))
return false;
return true;
}


My question is if there is a way to enable permissions for Temp tables without modifying the application.

Thank you.
Старый 27.03.2009, 10:18  Ссылка на сообщение   #2  
gl00mie is offline
gl00mie
Участник
Лучший по профессии 2009
MCBMSS
Most Valuable Professional
 
1,466 / 1232 (44) ++++++++
Регистрация: 28.11.2005
Адрес: Москва
Цитата:
Сообщение от em# Посмотреть сообщение
My question is if there is a way to enable permissions for Temp tables without modifying the application.
What's the purpose of setting permissions on temporary tables? They're always populated by code, and the originating data is usually taken from "real" tables or somehow produced by the code, so you can always perform an access validation in your code:
X++:
if (isTableUserEnabled( tablenum(CustTable) ))
{
    // populate temp table
}
else
{
    throw error( "@SYS60037" ); // Access denied
}
Besides, you never know where this or that temp table can be used. If an arbitrary temp table has a suitable set of fields then it's sometimes preferable to use it in your custom form/report then to create a new temp table. E.g. lots of standard reports in the localization for Eastern Europe use just a couple of temporary tables - both in Accounts Payable and Accounts Receivable modules. Obviously in this case it's more flexible and robust to validate access by security keys on menu items.
Старый 27.03.2009, 11:20  Ссылка на сообщение   #3  
Ivanhoe is offline
Ivanhoe
Участник
Аватар для Ivanhoe
КОРУС Консалтинг
 
837 / 316 (12) ++++++
Регистрация: 29.09.2005
Адрес: Витебск-СПб-Мск-СПб-Мск-СПб-Мск-СПб-...
You can set access for security key, all tmp-tables attached to that security key will automatically gain the same access level.
__________________
Ivanhoe as is..
Старый 27.03.2009, 11:55  Ссылка на сообщение   #4  
oip is offline
oip
Axapta
Аватар для oip
Лучший по профессии 2009
Most Valuable Professional
 
1,781 / 555 (22) +++++++
Регистрация: 28.11.2005
Адрес: Московская область
I can't even imagine why you need to make temp tables inaccessible for users. Could you please explain this to us? It's very interesting. As gl00mie said, temp tables are always used by programmers only to collect data (say from real tables and in this case it's correctly to set permissions to that real tables or to a menuItem that executes an operation filling your temp table). From this point of view temp tables are very similar to maps, arrays, recordSortedLists or even containers etc. So again, it's only a way to collect data.
__________________
С уважением,
Олег.
Старый 27.03.2009, 12:59  Ссылка на сообщение   #5  
em# is offline
em#
Участник
 
6 / 11 (1) +
Регистрация: 29.05.2008
Thanks All for the reply.

The table we want to allow permissions - tmpInventTransWMS - has a Security key on SYS layer.

The error below can be reproduced in Purchase orders screen, by selecting a purchase line, click Inventory button-> Registration.

“Not enough rights to use table 'Registration/picking' (TmpInventTransWMS).”

So, what security setup needs to be done for a particular user group to avoid this error? If temp tables have Security keys on SYS layer it is possible that there’s a way to manage them?

We can enable access to the temp table by setting access for the Security key the table is attached (in particularly for InventTables key), but it will enable some extra permissions to the user group.

Once again, thanks for help.
Старый 27.03.2009, 13:50  Ссылка на сообщение   #6  
gl00mie is offline
gl00mie
Участник
Лучший по профессии 2009
MCBMSS
Most Valuable Professional
 
1,466 / 1232 (44) ++++++++
Регистрация: 28.11.2005
Адрес: Москва
Цитата:
Сообщение от em# Посмотреть сообщение
The table we want to allow permissions - tmpInventTransWMS - has a Security key on SYS layer. So, what security setup needs to be done for a particular user group to avoid this error? If temp tables have Security keys on SYS layer it is possible that there’s a way to manage them?
You can modify the table and clear its SecurityKey property. Or as you've mentioned you can enable access to the corresponding SecurityKey and disable access to other affected "persistent" tables on a per-table basis.
Цитата:
Сообщение от em# Посмотреть сообщение
We can enable access to the temp table by setting access for the Security key the table is attached (in particularly for InventTables key), but it will enable some extra permissions to the user group.
Build CrossReferencies and look where a particular security key is used. As to the InventTables key, it seems that the only extra permission it gives (that cannot be disabled) is access to some other temporary tables from Invent and WMS modules. Also note that if a table has a ConfigKey attached and that ConfigKey is disabled then the table also becomes temporary despite its Temporary property value.

PS. Here's a sample job to find other temporary tables with SecurityKey set
X++:
Dictionary      dict = new Dictionary();
DictTable       dictTbl;
Counter         n;
;
for (n = 1; n <= dict.tableCnt(); n++)
{
    dictTbl = new DictTable( dict.tableCnt2Id( n ) );
    if (dictTbl && dictTbl.isTmp() && dictTbl.securityKeyId())
    {
        if (dictTbl.configurationKeyId() && !isConfigurationKeyEnabled( dictTbl.configurationKeyId() ))
            continue;                       // table is temporarty 'coz the corresponding configKey is disabled
        info( strfmt( @"Temporary table %1 has securityKey: %2", dictTbl.name(), securitykeyid2name( dictTbl.securityKeyId() ) ) );
    }
}
Старый 27.03.2009, 14:00  Ссылка на сообщение   #7  
oip is offline
oip
Axapta
Аватар для oip
Лучший по профессии 2009
Most Valuable Professional
 
1,781 / 555 (22) +++++++
Регистрация: 28.11.2005
Адрес: Московская область
Цитата:
Сообщение от em# Посмотреть сообщение
So, what security setup needs to be done for a particular user group to avoid this error?
Invent -> InventTables. I mean InventTables "group" itself without tables included in this group. The only table which securityKey has to be set to open InventTransRegister form is InventTrans. All other tables may be "turned off". And this will be a correct setup.
__________________
С уважением,
Олег.
Старый 27.03.2009, 18:44  Ссылка на сообщение   #8  
em# is offline
em#
Участник
 
6 / 11 (1) +
Регистрация: 29.05.2008
I set view rights to InventTables node, without tables and full access control to InventTrans table. The Registration form can be opened now.

Thank you all for the help.
За это сообщение автора поблагодарили: oip (1).
Старый 27.03.2009, 19:42  Ссылка на сообщение   #9  
oip is offline
oip
Axapta
Аватар для oip
Лучший по профессии 2009
Most Valuable Professional
 
1,781 / 555 (22) +++++++
Регистрация: 28.11.2005
Адрес: Московская область
Yes, when you make your security setup since it's a temporary table it isn't shown in the list of tables in the "tables node" . So in order to get access to your temp table it is enough to set any rights to the node InventTables.

PS If any of the answers above helped you we have a button "Thanks" just below every post. Welcome to AxForum!
__________________
С уважением,
Олег.
За это сообщение автора поблагодарили: em# (1).
 

Реклама

Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
gatesasbait: AP Posting fails because of security setup in Dynamics Ax 4 Blog bot DAX Blogs 0 03.02.2009 02:07
Inside Dynamics AX 4.0: Security Coding Blog bot DAX Blogs 0 31.10.2007 23:40
Inside Dynamics AX 4.0: The Security Framework Blog bot DAX Blogs 0 31.10.2007 11:40
Inside Dynamics AX 4.0: Configuration and Security Blog bot DAX Blogs 0 29.10.2007 10:50
axaptabuilder: How to build Axapta application from XPO files stored in Visual Source Safe. Blog bot DAX Blogs 0 22.11.2006 15:20
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра
Комбинированный вид Комбинированный вид

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.

Быстрый переход


Рейтинг@Mail.ru Rambler's Top100
Часовой пояс GMT +4, время: 16:50.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.