How do I verify user roles on my ACL

Posted on 2003-03-19
Medium Priority
Last Modified: 2013-12-18
Hello.  I am attempting to write a lotus script that will allow the database to verify user roles when a user logs on.  I have a role that I am only giving access to one form via a link. This role should not have access anywhere else.  I thought I would write a lotus script on the Global Init that would check the ACL and then close the database or not give the user access who is on this one specific role.  This code is giving me a type mismatch error and I think is one step off from working.  Can anyone help. Thank you.
Sub Initialize
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim acl As NotesACL
     Set db = session.CurrentDatabase
     Set acl = db.ACL
     If acl.Roles = "[Off Account]"  Then
     End If
End Sub
Question by:wrigh066
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 63

Expert Comment

ID: 8169326
Axel Matthies
05 Feb 2001, Rating 4.20 (out of 5)
The only way in script to check the roles of a user in the IsRoleEnabled function from NotesAclEntry - class. But this function don't work, when the user is member of a group and the the role is enabled for the group.
I have create a function which checks, whether a role is set for a User even if he is a member of a group.

Example how the function is calling:

If RoleEnabled("[Admin]") Then
  Messagebox "Role Admin is set"
  Messagebox "Role Admin not set"
End If


Function RoleEnabled(sRole As String) As Integer
     Dim vResult As Variant
     vResult = Evaluate(|@IsMember("| & sRole & |"; @UserRoles)|)
     If vResult(0) = 1 Then
          RoleEnabled = 1
          RoleEnabled = 0
     End If  'If vResult(0) = 1
End Function


I hope this helps !
LVL 24

Accepted Solution

HemanthaKumar earned 400 total points
ID: 8169380
You can use stratight forward method available in LS


Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Dim acl As NotesACL    
Dim entry As NotesACLEntry
Set db = session.CurrentDatabase
Set acl = db.ACL
Set entry = acl.GetEntry( session.CommonUserName )
If entry Is Nothing Then
  Set entry = acl.GetEntry( session.UserName )
End If
If entry Is Nothing Then
  Messagebox _
  "No entry for " & session.CommonUserName & _
  " or " & session.UserName,, "No entry"
  Exit Sub
End If
If entry.IsRoleEnabled( "[Supervisor]" ) Then
  Set uidoc = workspace.ComposeDocument( "", "approval" )
  Set uidoc = workspace.ComposeDocument( "", "request" )
End If

LVL 13

Expert Comment

ID: 8172673
So far I've always been using an evaluate like described by SysExpert. Works well!
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 24

Expert Comment

ID: 8174826
Why would you go round about way if there is a straight forward methods available in LS ?

Author Comment

ID: 8175470
Thank you this script is exactly what I needed!! I appreciate your help.
LVL 13

Expert Comment

ID: 8176388
Hemanth, I started doing so back in R4.5. Since it's a working one-liner, it's very tempting to just grab it again. I don't think I've ever come in a situation in R5 where I had to determine the assigned userroles. I might use the proper LS-way....

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question