Changing table permission through Code??

Hi all

I have situation where i need to change the permission of some table objects. The problem is the client is a standalone single user client and is located in a different city.

So I want to change the permission of the table objects through C/AL code and send the fob file for the distant client to import.

May be i can write a report which will have this code in one of its triggers and will update the permissions…i am not very sure of this

Can i change the permission of table objects by writing some code…?? (The table objects that i want to change are both standand navision objects and some new objects and its a Native Database / version 5 service pack 1)

please suggest!!

Thanks

Hi Sangam,

I could not really make out why at all do u need C/AL Code for changing permission. Are you trying to say that C/AL code is required because the

Had the client been local, then could you use standard roles & permission things? If that is the case, then perhaps you should make the roles in local database, export the relevant data (permissions for that role) and make a dataport for the client to import these in Permissions table.

Or may be you can connect to client using Team Viewer or similar software and do the required operations.

Hope it helps

Hi Sangam,

I also have problems understanding exactly what it is that you want to archive.

Is your problem that you need to allow this distant user to import the FOB file, but you don’t want to give him the permission of the SUPER user?

Thanks Dhan Raj

i got ur point and i think it shud work. Will try and update.

Hi Erik

The part where i want to update the permissions table is done now.

Now the problem is exactly what u stated. I dont want the distant user to give the super permission. His role doesnt allow him to write the permission table.

So i now want to run some code (may be in a report) which will allow the distant user to login as super user temporarily and then he can run the dataport and import the file to write into the permission table. Can it be done?

Hmmm,

I doubt if it can be done. As the user will not have permission to change role, and code will respect the security setting, so even through code he will not be able to do that.

But you may just give it a try :

Initially in “Member Of” table, change the user’s role to SUPER and then do the processing and in last change back the user’s role to same as earlier.

HAVE FUN [:)]

Hi Sangam,

Have you considered giving him the permission to the permission table as an indirect permission?

why don’t use remote desktop connection, or pc anywhere, or such as? so you can access that remote PC/ system from your computer.

Thanks Dhan Raj and Erik

I got it solved a different way. I decided to give the local user my super password to login as a super user. Then he would be able to import the fob file for the dataport which is used to import the file to write into permission table. Now, in the postdataport trigger, i am changing the super user password to a new value and closing the application through code. Therefore as soon as the dataport finishes its task, it also closes the application. and next time the distant user can not login as super with the password i told him.

Its actually not what i wanted to do, but it gets my job done. [:D]

Sangam,

I hope there are other Log-In IDs also with SUPER role, otherwise if changing password through code doesn’t work as expected then there can be problems :slight_smile:

I actually still do not understand exactly what’s your problem and why to go around doing so much fuss about it. But as long as you’re happy and have your solution, then I’m happy. Even if I think that you might have been able to find a much simpler solution.