Using Roles to Populate a Field

Posted on 2004-11-30
Last Modified: 2013-12-18
I have a field in my form that I would like to be populated from the ACL role assignments.

I want the user to be able to select a name from a list that is populated from the ACL roles assignments.

Is this Possible?
Question by:Jaziar
    LVL 14

    Expert Comment

    You have to use Notesacl class for this :

    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim acl As NotesACL
    Set db = session.CurrentDatabase
    Set acl = db.ACL
    Forall r In acl.Roles
      Messagebox( r )
    End Forall

    Author Comment

    p partha That gives me the roles, which is good.  But I need to list the users assigned to the roles in a field.

    Joe Smith        role = DE
    James White    role = PE

    I would like the field to get all the users that are in the role of PE.  The role will be static in the formula.

    so the value of the field would be James White

    You may have laid it out for me, but I am just missing it.
    LVL 31

    Accepted Solution

    Yes,possible.  You really need to hings:

    1) ALlow user to pick a name from the ACL
    2) Have something pick up the role(s) associated with the selected name.

    ...although there is one caveat.

    First, add a field to the form called NameFromACL, computed when composed, value ""
    Second, add a field called RolesForACLName, allow multiple values, computed when composed, value ""
    Third, add a button labeled "ACL Roles" with the following formula:

    Next, create a subform.  Copy the same two fields to the subform.
    Change the first field (NameFromACL) to type Dialog List, choices frmo ACL, enable refresh fields on keyword change.
    Hide the second field.
    Then, put the following code in the QueryClose of the subform:
        source.Document.ReplaceItemValue "RolesForACLName" , source.Document.parentDatabase.acl.getEntry(Source.FieldGetText("NameFromACL")).roles

    Caveat: An entry in the ACL can also be a group member of a group that is also listed in the ACL.  In that case, this may miss roles of the parent group.

    Author Comment

    There will be no groups in this database - only Roles

    Author Comment

    That Rocks - Thank You and Job Well Done

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
    This is an old article, please see an updated version of this article, located here:
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now