queryAccess (NotesDatabase - JavaScript)

Returns a person's, group's, or server's current access level to a database.

Defined in

NotesDatabase

Syntax

queryAccess(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 level, which is one of the following:
  • NotesACL.LEVEL_NOACCESS 0
  • NotesACL.LEVEL_DEPOSITOR 1
  • NotesACL.LEVEL_READER 2
  • NotesACL.LEVEL_AUTHOR 3
  • NotesACL.LEVEL_EDITOR 4
  • NotesACL.LEVEL_DESIGNER 5
  • NotesACL.LEVEL_MANAGER 6

Usage

If the name you specify is listed explicitly in the ACL, queryAccess returns the access level for that ACL entry and does not check the groups.

If the name you specify is not listed explicitly in the ACL, queryAccess checks if the name is a member of a group in the primary Address Book known to the computer on which the script is running. On a local workstation, that address book is the Personal Address Book. On a server, that address book is the Domino® Directory. If queryAccess finds the name in one or more groups, it returns the highest access level among those groups. If the name you specify is not listed in the ACL either individually or as part of a group, queryAccess returns the default access level for the ACL.

Examples

This computed field displays the access level for the current user in the current database.
var title:string = database.getTitle();
title = "For database \"" + title + "\" you have ";
var accLevel:int = database.queryAccess(session.getUserName());
switch (accLevel) {
	case(NotesACL.LEVEL_NOACCESS) : return title + "no access";
	case(NotesACL.LEVEL_DEPOSITOR) : return title + "depositor access";
	case(NotesACL.LEVEL_READER) : return title + "reader access";
  	case(NotesACL.LEVEL_AUTHOR) : return title + "author access";
	case(NotesACL.LEVEL_EDITOR) : return title + "editor access";
 	case(NotesACL.LEVEL_DESIGNER) : return title + "designer access";
	case(NotesACL.LEVEL_MANAGER) : return title + "manager access";
	default: return title + "unknown access";
}