GNU TeXmacsUser manualReferenceAboutEnglish
Users, groups, and permissions

The additional layer

database/db-users.scm

allows you to specify read, write and administration permissions for database entries. There are two main types of users of TeXmacs databases: individual users (entries of type "user") and groups (entries of type "group"). Groups may delegate permissions to individual users or other groups. In addition, the special user #t stands for the super user, which has all permissions, and the special value "all" in a permission field grants the corresponding permission to everybody.

Users are identified by the identifiers of their entries in the user database $TEXMACS_HOME_PATH/users/users-master.tmdb; routines such as (get-default-user), (pseudo->user pseudo) and (user->pseudo uid) allow for the conversion between identifiers and pseudos.

Macros for context specification
(with-user user . body)
(specify current user)

Evaluate the body using the permissions of the specified user, which is either a user identifier, a list of user identifiers, or #t (the default, meaning no restrictions).

Special attributes
pseudo

Specifies a pseudo for the user. Notice that name should specify the full name.

owner, readable, writable

Ownership and read/write permissions for an entry. Notice that the wrappers below only check the owner and readable permissions: modifications require ownership. Under the encoding scheme :pseudos, the values of these fields are represented by user pseudos instead of user identifiers.

delegate-owner, delegate-readable, delegate-writable

Delegate group permissions: a user (or group) listed in the delegate-readable field of a group inherits the readable permissions of that group, and similarly for the other attributes.

Affected routines of the database API
(db-set-field id attr vals)
(set values for a given field)
(db-set-entry id l)
(fill out a complete entry)
(db-remove-entry id)
(remove a complete entry)

The actions only succeed when the current user owns the entry.

(db-create-entry l)
(create a new entry)

Unless the current user is #t, the current user is added to the owners of the new entry. If the resulting list of owners is empty, then no entry is created and #f is returned.

(db-get-field id attr)
(get all values for a given field)
(db-get-entry id)
(retrieve a complete entry)
(db-search q)
(search for a list of fields)

Only values are returned for which the current user has appropriate permissions (ownership or read permission). In the case of db-search, only entries owned by or readable for the current user are returned.

Other useful routines
(db-allow? id uid permission-attr)
(check permissions)

Check whether a user with identifier uid has a given permission permission-attr (such as "owner" or "readable") for the entry with identifier id. Group delegations are taken into account, and owners automatically have all other permissions.

(db-expand-user uid attr)
(expand user by group membership)

Return the sorted list of the user uid (a user identifier or a list of identifiers) and all groups from which uid inherits the permission attr through delegation, followed by "all".

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".