Equinox Online Help - Language Reference - A to Z

Home

RecordPermissions

Applies to
SyntaxRecordPermissions(RecordgroupExpression)
Action[Function] Returns the current user's ESS record access.
ScopeUsable anywhere.
Notes

This function returns the current user's ESS record access permissions for a specified record group. The record group number is supplied in the argument RecordgroupExpression.

If zero is returned, then the user has no permissions. Otherwise the permissions are arranged in the return value as a bit array. The bits are assigned to the following permissions:

  • 0 Visible (the group's records are visible)
  • 1 Insert (the user may insert records in the group)
  • 2 Edit (the user may edit records in the group)
  • 3 Delete (the user may delete records in the group)
  • 4 Shown (the record group is not filtered by ShowRecordGroup)

Using bit arrays. The access method relies on the binary AND operator, which can detect if a bit is set in a source number by combining it with a test number with one bit set. eg To detect if bit 2 is set use the test number 4, which is 100 in binary. A group with Visible and Edit rights will return the value 5; the expression (5 AND 4) returns 4. You may test for any of a set of rights by adding up the test numbers; the test value 14 checks for any of Delete, Edit or Insert rights (8 + 4 + 2). To test for all of a set of rights, you must check that the result is the same as the test number. The test numbers for bits 0, 1, 2, 3 and 4 are 1, 2, 4, 8 and 16 respectively.

Note that binary operations in conditional statements must be enclosed in brackets, to distinguish them from logical ones.

CategoryUser, groups and ESS
See Also ChangeRecordGroup, CurrentRecordGroup, FieldPermissions, FirstUserGroup, FirstUserName, UserCreate, NextUserGroup, NextUserName, SetUserGroup, ShowRecordGroup, UserAccountExpiry, UserDelete, UserDetails, UserGroup, UserName, UserPasswordExpiry, UserPermission
Example

The following method determines whether the user has either insert or edit permission for the record currently being added to the database. If not, an error is reported.

if Not (RecordPermissions(DocumentClass) And 6) then
Alert "You are not authorised to change this document"
ChangeObject CurrentObjectName
end if

A similar method only allows a change if the user has both insert and edit permission.

if (RecordPermissions(DocumentClass) And 6) <> 6 then
Alert "You are not authorised to change this document"
ChangeObject CurrentObjectName
end if

This method finds the first record group not filtered by ShowRecordGroup, or group zero if they are all filtered.

for i = 1 to 1024
if (RecordPermissions(i) And 32) then exit for
next

if i > 1024 then i = 0