Community
Showing results for 
Search instead for 
Do you mean 
Reply

How can check act login by Admin or not ?this code does not work

Avid Listener
Posts: 30
Country: india

How can check act login by Admin or not ?this code does not work

Hi

 

are you sure? this code was running .  Here I have tryied this code does not work . for any case . what will I do?

 

'creating new framework object

 Dim actapp As ActFramework

actapp = New ActFramework

 

'loggin on act

actapp.LogOn("C:\Documents and Settings\Chandrakant.Pitroda\My Documents\ACT\ACT for Windows 11\Databases\ACT11Demo.PAD", "Chris Huffman", "")

 

If (actapp.Roles.Equals(actapp.Roles.Role_Administrator)) Then

MessageBox.Show("admin")

ElseIf (actapp.Roles.Equals(actapp.Roles.Role_Browse)) Then

MessageBox.Show("browse")

ElseIf (actapp.Roles.Equals(actapp.Roles.Role_Manager)) Then

MessageBox.Show("Manager")

ElseIf (actapp.Roles.Equals(actapp.Roles.Role_Restricted)) Then

MessageBox.Show("restricted")

ElseIf (actapp.Roles.Equals(actapp.Roles.Role_Standard)) Then

MessageBox.Show("Standard")

 

End If

 

 

SNS

 

Saket

Copper Contributor
Posts: 29
Country: USA

Re: How can check act login by Admin or not ?this code does not work

Instead of checking it that way, try actapp.CurrentUser.Role.
Copper Contributor
Posts: 91
Country: USA

Re: How can check act login by Admin or not ?this code does not work

Hi,

 I've posted this for you in all your posts about this. There are other ways to do this but this a just 1 simple way to get and manipulate the data

 

          
            //Create user object and get the currently loggted in user

            User testUser = ActFwk.Users.GetUser(myRecord);

            //Show the user role in message box user.role.ToString()

            MessageBox.Show(testUser.Role.ToString());

 

*Role is part of Act.Framework.Users.User Class