User Role

Hello All,

How can I get the current User role or a User type of a logged user?

Thanks

  • Should be able to use the UserInfo function. Look for it In the help
  • Hello Nick,

    UserInfo

    The type of user information:

    0 - Flag to indicate whether any user other than a view-only user is logged in

    1 - The login name of the user

    2 - The full name of the user

    3 - The time the user logged in

    4 - The time the user entered the last command

    5 - The number of commands entered by the user

    6 - The type of login:
    •"0" indicates that the current user is a view-only user.
    •"1"indicates there is Citect SCADA or Windows non-default user explicitly logged in.
    • "2" indicates the logged on user is a Citect SCADA default user (control client auto login Citect SCADA user).
    •"3" indicates the logged on user is a Windows default user (control client auto login windows user).

    Return Value

    Don´t have the Role
  • I ran into this issue also. I had requested the developers create a Cicode function to return this information, but it hasn't happened yet. Feel free to request it from Citect support to increase the priority of the enhancement request.

    If you just have a single project with Citect users defined, you could use the device functions like DevOpen() to open users.dbf in your project and find the current user's role(s). If you have Windows/domain users then you can't do that. I wrote some Cicode that you can call from the Entry Command of each Role definition. It creates a list of all roles that have been applied to the currently-logged-in user, then allows you to check if the user has specific roles. See TN8210 for the code and instructions.