queryAccessPrivileges (NotesDatabase - JavaScript)

Returns the privileges of a person, group, or server in a database.

Defined in

NotesDatabase

Syntax

queryAccessPrivileges(name:string) : int
Parameter Description
name The name of the person, group, or server. For a hierarchical name, the full name must be specified but can be in abbreviated format.
Return value Description
int The current access privileges, a combination of the following:
  • DBACL_CREATE_DOCS 1
  • DBACL_DELETE_DOCS 2
  • DBACL_CREATE_PRIV_AGENTS 4
  • DBACL_CREATE_PRIV_FOLDERS_VIEWS 8
  • DBACL_CREATE_SHARED_FOLDERS_VIEWS 16
  • DBACL_CREATE_SCRIPT_AGENTS 32
  • DBACL_READ_PUBLIC_DOCS 64
  • DBACL_WRITE_PUBLIC_DOCS 128
  • DBACL_REPLICATE_COPY_DOCS 256
Individual privileges can be discerned through bitwise operations.

Usage

If the name you specify is listed explicitly in the ACL, then queryAccessPrivileges returns the privileges for that ACL entry and does not check groups.

If the name you specify is not listed explicitly in the ACL, queryAccessPrivileges checks to see if the name is a member of a group in the primary address book where the program is running: on a workstation the Personal Address Book; on a server the Domino® Directory.

Examples

This button gets the privileges of the current user for the current database.
var title:string = database.getTitle();
var user:string = session.getUserName();
var accPriv:int = database.queryAccessPrivileges(user);
requestScope.status = "Privileges for " + user + " in " + title;
// Check each privilege bit to see if it is 0 or 1
if ((accPriv & NotesDatabase.DBACL_CREATE_DOCS) > 0)
	requestScope.status += "\n\tCreate documents";
if ((accPriv & NotesDatabase.DBACL_DELETE_DOCS) > 0)
	requestScope.status += "\n\tDelete documents";
if ((accPriv & NotesDatabase.DBACL_CREATE_PRIV_AGENTS) > 0)
	requestScope.status += "\n\tCreate private agents";
if ((accPriv & NotesDatabase.DBACL_CREATE_PRIV_FOLDERS_VIEWS) > 0)
	requestScope.status += "\n\tCreate private folders/views";
if ((accPriv & NotesDatabase.DBACL_CREATE_SHARED_FOLDERS_VIEWS) > 0)
	requestScope.status += "\n\tCreate shared folders/views";
if ((accPriv & NotesDatabase.DBACL_CREATE_SCRIPT_AGENTS) > 0)
	requestScope.status += "\n\tCreate LotusScript/Java agents";
if ((accPriv & NotesDatabase.DBACL_READ_PUBLIC_DOCS) > 0)
	requestScope.status += "\n\tRead public documents";
if ((accPriv & NotesDatabase.DBACL_WRITE_PUBLIC_DOCS) > 0)
	requestScope.status += "\n\tWrite public documents";
if ((accPriv & NotesDatabase.DBACL_REPLICATE_COPY_DOCS) > 0)
	requestScope.status += "\n\tReplicate or copy documents";