Equinox Online Help - Language Reference - A to Z
RecordPermissions |
|
---|---|
Applies to | |
Syntax | RecordPermissions(RecordgroupExpression) |
Action | [Function] Returns the current user's ESS record access. |
Scope | Usable 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:
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. |
Category | User, 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) thenAlert "You are not authorised to change this document"end if A similar method only allows a change if the user has both insert and edit permission. if (RecordPermissions(DocumentClass) And 6) <> 6 thenAlert "You are not authorised to change this document"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 1024if (RecordPermissions(i) And 32) then exit fornext |