Link to home
Start Free TrialLog in
Avatar of seko22an
seko22an

asked on

Script that checks if a user have a role

Hi

I have a script that checks if a user have a role. It function OK for users in the accesslist but not if a group that a user belonng to and the group have a role.

What is missing?

Sub Querysave(Source As Notesuidocument, Continue As Variant)
      On Error Goto felr
      
      Dim s As New NotesSession
      Dim db As Notesdatabase
      Dim acl As NotesACL
      Dim ent As NotesACLEntry
      Dim uN As New NotesName(s.UserName)
      
      Set db = s.CurrentDatabase
      Set acl = db.ACL
      Set ent = acl.GetEntry(uN.Canonical)
      
      Continue = False
      
      Forall loop1 In ent.Roles
            If loop1 = "[spmotion]" Then
                  Continue = True
            End If
            Msgbox loop1
            
      End Forall
      
fel:
      
      If Continue = False Then
            Msgbox "Du har ej behörighet att spara dokument"      
      End If
      
      Exit Sub
      
felr:
      
      Resume fel
      
End Sub
Avatar of martijnmulder
martijnmulder
Flag of Honduras image

why don't you use :

evaluate("@userroles") ?
Avatar of Arunkumar
Arunkumar

I guess your exit sub is in the wrong place.
ASKER CERTIFIED SOLUTION
Avatar of Joep8020
Joep8020

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial