Get role from logged in user?

Hi!

I want to get the active users role. I´ve searched a lot now and can´t seem to find a function for it like UserInfo.

My "sollution" as for now is to roll through the USERS.RDB and get it from there, but there must be a better way?

/Anders

Current "sollution": (Pasting it here removes the indents. Oh well..)

FUNCTION SFA()

STRING sROLE
STRING sUserRDB
STRING sUserIn = UserInfo(1)
INT hRdb
INT nRecord

hRdb = RdbOpen("_USERS")
IF (hRdb <> -1) THEN
nRecord = RdbFirstRec(hRdb)
WHILE (nRecord <> -1)DO
sUserRDB = RdbGet(hRdb, "NAME")
IF sUserRDB = sUserIn THEN
sROLE = RdbGet(hRdb, "ROLES")
nRecord = -1
ELSE
nRecord = RdbNextRec(hRdb)
END

END
RdbClose(hRdb)
END

END

Parents
  • Thanks!

    I'll head on and request it as well, maybe they´ll look in to it if we request it a lot. :)

    Yes, my code has a few limitations, but as a quick fix and for my current application it should work. And since there´s no built in function for it´ll have to do I guess.
    I´ll take your code in consideration though.

    Also, thanks for the tip on pasting code. Maybe they could put code-tags to this forum like other programming forum has?
Reply
  • Thanks!

    I'll head on and request it as well, maybe they´ll look in to it if we request it a lot. :)

    Yes, my code has a few limitations, but as a quick fix and for my current application it should work. And since there´s no built in function for it´ll have to do I guess.
    I´ll take your code in consideration though.

    Also, thanks for the tip on pasting code. Maybe they could put code-tags to this forum like other programming forum has?
Children
No Data