Script for NAV 5.0 and SQL Server 2005 to add users (+roles) in SQL and in NAV

Script for NAV 5.0 and SQL Server 2005 to add users (+roles) in SQL and in NAV

This question is not answered

Hi,

For an educational setting we would like to enroll users to NAV 5 databases and companies through a script in SQL when adding the users. We have decided to user database logons (not windows logon)

We have about 50 databases with 40 companies each and would like to have a way of minimizing the effort of adding users and refreshing databases (after each period of 10 weeks). We will name the users R301S01 ... R301S40, R302S01... R301S40 and so on, where R30x is the name of the database.

We're trying to set up an initial user management.

Starting position is (I think) a NAVdatabase with only one superuser, that is already known in SQL. In this database there are 40 companies. Each user (student) needs his/her own company. I only sync the superuser in NAV.

So we would like to have a script that addresses the following issues:

- add user with password in SQL with usual rights in NAV (db_owner?)
- add the same user in the NAV database in a specific database/company
- give the user in NAV in that database/company roles 'all' and 'super(data)'
- make sure that the users are synchronized between NAV and SQL


First question: Is this possible?
Second question: How can we achieve this?
Third question: Do you hav an example of the script? Please?

Thanks very much for your assistance.
My students (Dutch university of applied science with little money for implementations...) will be very happy when they can work with NAV!

Hans van der Hoeven
The Netherlands

All Replies
  • Hello,

     

    I do not know if you already have solution for you (I saw your question on other forums), but there is my bit:

    Let split the problem into two:

    1) Creating users on SQL - you need to call SQL query from NAV through ADO to create them. See e.g. this

    2) Create users in NAV and assigning them the roles - this is easy, because you just needs to create appripriate records in the correct tables (e.g. User and Member Of).

     

    And one question: have you someone who is able to crate these small pieces of code for you?

  • Thanks, Kine. I did indeed post to different forums.

    I've received an example of the code and the SQL Server specialist of our University has fine tuned it for our needs. Tomorrow he will demonstrate the running of the tool he has designed (some other features are added).

    So, if I still see problems after tomorrow, I will get in touch?

    Thanks for your post (and question...)

    Regards,

     Hans