Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Security API > Methods

Security API: setPermissions

Scroll Prev Next More

 

Sets permissions for a certain table for the current user. Permissions need to be set only once per user session, i.e., in the After Successful Login event.

 

Permissions should be passed in the form of an array where the keys are specific permission letters:

 

A - add,

D - delete,

E - edit,

S - search/list,

P - print/export,

I - import,

M - admin permission. When advanced permissions are in effect (e.g., Users can see/edit their own records only), this permissions grants access to all records.

Syntax

Security_setPermissions(table, rights)

Arguments

table

the name of the table.

rights

an array where the keys are specific permission letters or a string with permissions like "ADESP".

Return value

No return value.

Example 1

Enable the Add and disable Delete functionality for the "Cars" table for the current user:

 

set rights = Security_getPermissions("Cars")
rights("A") = true
rights("D") = false
Security_setPermissions("Cars", rights)

Example 2

Check if the current user has Add permissions for the "Cars" table:

 

set rights = Security_getPermissions("Cars")
  if bValue(rights("A")) then
  response.write "add permission available"
end if

Example 3

 

Enable the Add and Delete functionality for the "Cars" table for the current user, passing the string as the parameter.

 

 

 

Security_setPermissions("Cars", "AD")

See also:

Security API: getPermissions

Event: GetTablePermissions

User group permissions

About Security API