Hello everyone,
i am using navision roles for my own rights to some objects (i want to have some buttons to be visible only for account with SUPER role, for example...) and with database accounts it is not problem (just use of 1 navision table - Member Of and command USERID, which return current user) but when i use the domain accont, the command USERID returns only second part of domain name (returns only Tom for account DOMAIN/Tom) and beside i have to use different table Windows Access Control, instead of Member Of - i cannot get the correct record, if i dont want use wrong method like SETFILTER('Login ID', '
@*/TOM') which is correct for atleast some settings (not same names in different domains)...
any workarounds here?
Robik
Comments
Query the Session table where MySession = True.
This would give you Domain\User, and also the Login Type (Windows,Database).
This should be enough information to query the correct table, in order to find out whether the user belongs to SUPER or not.
Regards,
Gus
Works great
I've been messing around for hours with the "Windows Login" table, and the virtual table "SID - Account ID", trying to match the USERID (uppercase, no domain name) with the "User ID" (mixed-case, with domain name, that is a FlowField). Your post was very helpful.
Thanks,
Alastair
You should use the Sessions table only to query the type of authentication. It normally makes no sense to use the username from this table. It is better to use user sid virtual table what contains all sids of a current user. You should in fact check them all, as user may have permissions also granted due to belonging in some activedirectory group.
the relevant code would be:
But surely it contains many other SIDs as well. How are you going to filter them out?
For example the SID table for me contains following rows:
ID
Everyone
NT AUTHORITY\Authenticated Users
NT AUTHORITY\NETWORK
RLK\URMAS
RLK\Arvutuskeskus
RLK\KONTROLLERID
RLK\IT OSAKOND
RLK\kmp-admin
RLK\METAFRAME1
RLK\Domain Admins
RLK\Domain Users
RLK\Domain Guests
RLK\Enterprise Admins
BUILTIN\Administrators
BUILTIN\Users
(sorry - I will not publish actual SID-s for understandable reasons).
This list is specific to me only. Naturally someone else can have also SID of RLK/Users and also permissions tied to this group.
thanks, the code worked, with one small change - I used something like
blnFound :=
recWindowsRole.GET(recUserSID.SID,'My Role',COMPANYNAME) OR
recWindowsRole.GET(recUserSID.SID,'My Role','');
By the way, I just learnt from a Navision.net posting that in Navision 4.0 the individual users' Windows Accounts must be added to the Windows login table (see quote below).
Alastair
From "Update for Microsoft Business Solutions-Navision 4 0.pdf"