I am trying to set up custom security for 5 reports I have created. They should only be allowed to be run by users who have a new role (EXCEL-MARGINS). I added the following code to the OnInitReport trigger of 1 of the reports: IF (NOT MemberOf.GET(USERID,‘SUPER’,’’)) AND (NOT MemberOf.GET(USERID,‘SUPER’,COMPANYNAME)) AND (NOT MemberOf.GET(USERID,‘EXCEL-MARGINS’,’’)) AND (NOT MemberOf.GET(USERID,‘EXCEL-MARGINS’,COMPANYNAME))THEN ERROR(‘You do not have permission to run this report.’ + ‘Contact your system administrator for assistance.’); I added MemberOf as a Global variable, and in the Report Properties, I made sure that the Permissions were set to RIMD for the Member Of table. When I try to run this as a regular user, I get the messge, You do not have read permission for the Member Of table. Contact your system manager if you need to have your permissions changed. What am I doing wrong??? This is a 3.01B database. Thanks, - Jim -
You must give the users readpermission to Table Data 2000000003 “Member of”. I fail to see why you’re coding this - can’t you just set up the permissions?
I’ll tell you why. It is such a major pain in the ass to set up any security in Navision. Every time I go down this road, it burns at least 2 hours in trying different things and testing. I was hoping that by doing it this way that ANYBODY that came behind me would be able to quickly and easily tell what’s going on. To set it up using the Navision way would probably mean removing the Report 0 Yes in Role ALL, creating a new role called ALLREPORTS and giving Yes to every report in the system except the 5 new ones, adding the new ALLREPORTS role to every user, then in my new EXCEL role, put the 5 new reports with Yes in it and add that role to the people that need access. Sound about right?
What about adding a Flag to the User Setup Table (“All Reports”)? IF NOT UserSetup.GET(USERID) THEN CLEAR(UserSetup); IF NOT UserSetup.“All Reports” THEN ERROR(‘You do not have permission to run this report.’ + ‘Contact your system administrator for assistance.’); Another option might be to access a table in this report that only “Super” users have access to… IF NOT GLAccount.WRITEPERMISSION THEN ERROR(‘You do not have permission to run this report.’ + ‘Contact your system administrator for assistance.’);
I decided to go with my original thought at the top. I put the code in a function in the Member Of table so I could continue to use this easily for future reports they are thinking of. I added the new Role without any permissions behind it, and added the Member Of table to the ALL role with Read Yes and Indirect to everything else. Then they just have to add the new role to users that need these 5 reports. Thanks to all!