License usage by company

orossiorossi Member Posts: 12
Hi.
I have Navision running on SQL Server, and I have a 53 user license. I have 3 companies in 3 separate databases. Each company has its own users, and some common users.
Is there any way to define a maximum number of logins by companies, like in navision db when defining the service with the parameter 'Sessions'?

I would appreciate a lot any help about this issue.

Thanks and Happy New Year!!
Osvaldo Rossi

Comments

  • ara3nara3n Member Posts: 9,257
    you would need to make a modification. Create a new table company independent, as users login in for a company insert a record into the table with user ID company name. When they log out delete record. Also if any user that doesn't exists in session table should be deleted as well, just in case some user killed the client. Also as you insert the record check and see how many records allready are in that company, if it reaches your limit error out.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kinekine Member Posts: 12,562
    ara3n - problem is that the companies are in separate databases...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,118
    In codeunit 1, function "CompanyOpen()", you know in which company (and in which DB you are), so filter on the "Session"-table the users in this DB. You can put a new field in the "Company Information"-table to indicate the maximum no. of users in the company (for you, this is max no. of users in the DB). If you exceed the no, give an ERROR.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ara3nara3n Member Posts: 9,257
    oh didn't read that part. In that case each database is separate company, the session table shows which database you are logged in, and follow kriki advise.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • i4tosti4tost Member Posts: 208
    Do you have three licenses?
  • orossiorossi Member Posts: 12
    Thanks a lot for all your help. I was just thinking in modifying CU 1 and use the session table. I'll keep U informed as I progress.
    I've modified the Sessions view in the SQL DB to filter only the sessions belonging to this database and it works fine.

    Regards
    Osvaldo Rossi
  • orossiorossi Member Posts: 12
    Thanks to the wise advice of all of you, I finally came up with the solution. Here you have what I've done:

    1. Add a field in the Company Informtaion table. Name i.e. "No. of max users" integer.
    2. In this field you enter the maximum amount of connections allowed.
    3. Modify CU 1 with the following code:
    Variables
    companyInfo Record "Company Information"
    sesion Redord "Session"
    usersmax Integer
    users Integer

    Here is the code...

    CLEAR(companyinfo);
    companyinfo.GET;
    usersmax := companyinfo."No. of max users";
    users := 0;
    CLEAR(sesion);
    users := sesion.COUNT;
    //No of users validations
    //Never forget to leave a 'security device'
    //(Note te USERID overriding. Just in case of emergency)

    IF ((users > usersmax) AND (USERID <> 'orossi')) THEN
    ERROR (STRSUBSTNO('You've reached the maximum no. of connections allowed.\\'+
    'You are user no. : %2\'+
    'Max. no. of users: %1\'+
    'Your User ID : %3',usersmax, users, USERID));


    Suggestions, improvements are welcomed.
    Osvaldo Rossi
Sign In or Register to comment.