@UserAccess (Formula Language)

Given a server and file name, indicates the current user's level of access to the database.

Note: If you used @UserAccess in Release 4, it is automatically converted to @V4UserAccess in Release 5 or later to preserve the functionality of your formulas. If you change those formulas to use @UserAccess, be sure to recompile them under Release 5. If you use @UserAccess in Release 5, a database created in Release 4 will not recognize the formula until you upgrade that database to Release 5. If the formula will be evaluated in Release 4, use @V4UserAccess.
Note: The AccessPrivilege keyword option is new with Release 6.

Syntax

@UserAccess( server : file ; [ accessPrivilege ] )

Parameters

server

Text. The name of the server. Use an empty string ("") to indicate the local computer.

file

Text. The path and file name of the database. Specify the database's path and file name using the appropriate format for the operating system.

[ accessPrivilege ]

Keyword. Optional. Specify one of the following keywords to return a user's access level or test for a specific database privilege, instead of returning a list containing all of the user's access information:

  • [ACCESSLEVEL] returns a number from 1 to 6 that indicates the user's access level to the database.

    Level

    User's access level

    1

    Depositor

    2

    Reader

    3

    Author

    4

    Editor

    5

    Designer

    6

    Manager

The following return 1 (True) if the user has the specified privilege and 0 (False) if the user does not. These privileges are assigned in the Access Control List for the database.

  • [CREATEDOCUMENTS]
  • [DELETEDOCUMENTS]
  • [CREATEPERSONALAGENTS]
  • [CREATEPERSONALFOLDERSANDVIEWS]
  • [CREATELOTUSSCRIPTJAVAAGENTS]
  • [CREATESHAREDFOLDERSANDVIEWS]
  • [READPUBLICDOCUMENTS]
  • [WRITEPUBLICDOCUMENTS]
  • [REPLICATEORCOPYDOCUMENTS]

Return value

If you specify one or more keywords, returns a text value or a text list containing the following values:

  • The [AccessLevel] keyword returns a value of 1 through 6.
  • The other keywords return a value of 1 or 0.

If you specify no keywords, returns a text list of values for the following keywords:

  • [AccessLevel] : [CreateDocuments] : [DeleteDocuments] : [CreatePersonalAgents] : [CreatePersonalFoldersAndViews] : [CreateSharedFoldersAndViews] : [CreateLotusScriptJavaAgents] : [ReadPublicDocuments] : [WritePublicDocuments]

    @UserAccess does not test for access to the ReplicateOrCopyDocuments privilege by default.

    Tip: If the multi-value separator for the field containing the formula is a semicolon, the values in the returned text list are separated by semicolons instead of colons.

Usage

On a local database without "Enforce a consistent Access Control List," @UserAccess without the second parameter always returns 6; 1; 1; 1; 1; 1; 1; 1; 1. If the current user has No Access to the database, Notes/Domino displays a message: "You are not authorized to perform that operation."

This function does not work in column or selection formulas, or in agents that run on a server (mail and scheduled agents). Hence it does not work with the Evaluate statement.

Examples

  1. This formula returns the text list 3: 1: 1: 1: 1: 0 if the user has Author access, permission to create documents, delete documents, create private agents, create personal views and folders, but does not have permission to create shared views and folders in the NUN.NSF database in the DISCUSS directory on server Gaborone.
    @UserAccess( "Gaborone" : "discuss\\nun.nsf" )
  2. This formula, when added to a form action button, creates a new document using the MyOpinion form if the current user has the privilege to create documents in the current (nun.nsf) database.
    @If(@UserAccess( "" : "discuss\\nun.nsf" ; [CREATEDOCUMENTS]) = "1";@Command([Compose];"MyOpinion");@Prompt([OK];"Access denied";"Sorry, you do not have permission to create documents in this database."))
  3. This formula returns the text list 6: 1: 1: 1: 1: 1: 1: 1: 1 if the user has Manager access and permission to create and delete documents, create private agents, create personal and shared views and folders, create LotusScript® and/or Java agents, read and write public documents in the current database. The text list displays as 6; 1; 1; 1; 1; 1; 1; 1; 1 if the multi-value separator for the field containing this formula is a semicolon.
    @UserAccess( @DbName )