If a user isn't configured on User setup, logoff from NAvisi

Saalek
Saalek Member Posts: 181
Hi

I have a problem:
If a user is created in Database, I must verify if this user is configured in a company. If a user isn't created in User setup table, I must logoff this user denying access to this company.

I tried to change Codeunit 1 -> OpenCompany function adding this code.
IF NOT TUser.GET(USERID) THEN
  BEGIN
    ERROR('User '+ USERID +' isn't configured');
    LogInEnd;
  END;

The errror message appears, but the company is opened.

Any suggestion ?? [-o< [-o<

Thanks

Comments

  • garak
    garak Member Posts: 3,263
    1: The function LogInEnd will not run, because error break all transactions and code. Use message for this.

    2: but why you doesn't use the permissions for this? Here you can set the companys where the user has the rights to work with!

    Regards
    Do you make it right, it works too!
  • Saalek
    Saalek Member Posts: 181
    1- I tried with message, but doesn't work.

    2- Our customer wouldn't like to use roles

    Thaks
  • garak
    garak Member Posts: 3,263
    he would't like to use roles?
    They are all super users?

    An other solution is, send ALT+F4 to the application. Then the Navision application will be closed :lol:

    Regards
    Do you make it right, it works too!
  • David_Singleton
    David_Singleton Member Posts: 5,479
    Saalek wrote:
    1- I tried with message, but doesn't work.

    2- Our customer wouldn't like to use roles

    Thaks

    Unless your customer is very rich, and plans to spend a lot of money with you, you should advise them against this. If they decide not to use built in Navision security, and instead decide to have you do "Just This One Modification", then they will find that every week they will find they need "Just One More Modification" and the cost will mount, then they will want to upgrade, and need to revisit it all again.

    Sit with your customer and show them the benefits of using built in functionality. If you don't then some time down the track they may be looking for a new partner.
    David Singleton
  • Saalek
    Saalek Member Posts: 181
    I sit with my customer, I explain him Navision security system, roles, ...

    but he said it is a bit complicated for him

    Thank for your answers
  • garak
    garak Member Posts: 3,263
    A bit complicated? OK, than all users are super.

    But also by super users, you can select for wich company the role is.

    so you have the Line

    RoleID | Rolename | Companyname


    regards
    Do you make it right, it works too!