grantAccess (NotesDatabase - JavaScript)

Modifies a database access control list to provide a specified level of access to a person, group, or server.

Defined in

NotesDatabase

Syntax

grantAccess(name:string, level:int) : void
Parameter Description
name The name of the person, group, or server whose access level you want to provide or change. For a hierarchical name, the full name must be specified but can be in abbreviated format.
level The level of access you're granting. Specify one of the following constants:
  • 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 already exists in the ACL, this method updates it with the access. Otherwise, the name is added to the ACL with the level.

You can also use this method to deny access to a person, group, or server by assigning LEVEL_NOACCESS.

This method sets ACL roles to their default values.

Examples

This button creates a database from the discussion template.
var template:NotesDatabase = session.getDatabase(null, "discussion8.ntf", false);
if (template == null) {
	requestScope.status = "discussion8.ntf does not exist locally";
	return;
}
var newdb:NotesDatabase = template.createFromTemplate (null, "suggest", true);
newdb.setTitle("Suggestions for Giving Campaign");
newdb.grantAccess("-Default-", NotesACL.LEVEL_READER);
requestScope.status = "\"Suggestions for Giving Campagn\" created";