Wydawca |
|
Release Submission Daemon |
Sergey Poznyakoff |
A dictionary defines the ways to retrieve user information necessary to verify the submission. This information can be, for example, the user’s PGP key or his permissions on a project.
A dictionary is defined in configuration file using the following syntax:
dictionary dict-id { type type; query string; params (param1,param2,…); }
The dictionary
statement can appear either in the global scope of
the configuration file, or inside a spool
statement
(see spool). Global definitions affect all spools
in the configuration file, and ones inside a spool
statement override them for that particular spool.
There are two dictionaries, identified by the value of dict-id tag:
Keeps email addresses and real names of administrators (or owners) of a project. It may return any number of rows, each one consisting of two columns: an email address and a user name, in this order.
Keeps system user names, real names, emails and GPG keys of the users that are allowed to make uploads for the project.
The sub-statements of dictionary
are:
Defines the type of this dictionary. Name is one of the following:
The data are supplied in the configuration file.
Retrieve data from an SQL database. Currently only
MySQL
is supported.
Retrieve data using an external program. This dictionary type is reserved for future use.
See below for a detailed description of these dictionary types.
Sets the query used for retrieving the data. The string is subject to variable expansion (see variable expansion). The following variables are defined in this context:
project
The system name of the project for which the triplet is
submitted. The project name is obtained from the directory
directive. If the value of this directive contains subdirectories,
the first (topmost) directory is used as ‘project’.
spool
The name of the distribution spool where this upload originates (see spool).
url
The URL of the spool, as set in the url
statement
of the spool
block (see url).
dir
Directory (relative to the project distribution root) where the files are going to be uploaded.
dest_dir
Spool destination directory (see destination).
source_dir
Spool source directory (see source).
user
user:name
The system name of the user that submitted the triplet. This is defined only for ‘project-owner’ dictionaries.
comment
The value of the ‘comment’ field from the directive file.
Supplies additional parameters.
Dictionaries of ‘sql’ type retrieve information from an SQL database (as of version 4.0.3, only ‘MySQL’ databases are supported).
The query
statement supplies the SQL query to
execute. Normally, it should be a SELECT
query.
The params
statement must supply a single parameter –
the identifier of one of the preceding sql
blocks (see sql),
which determines database name and user credentials needed to access it.
The following sub-nodes contain sample definitions for the
sql
dictionaries. They are based on the database structure used in
Savane
system.
This dictionary retrieves email addresses and real names of administrators (or owners) of a project. It may return any number of rows, each one consisting of two columns: an email address and a user name, in this order.
dictionary project-owner { type sql; params (default); query "SELECT user.email, user.realname " "FROM user,user_group,groups " "WHERE user_group.user_id=user.user_id " "AND user_group.group_id=groups.group_id " "AND user_group.admin_flags = 'A' " "AND groups.unix_group_name = '${project}'"; }
This dictionary assumes that the ‘user’ table has a special column, ‘upload_flags’, whose value is ‘Y’ for those users who can do uploads for this project:
dictionary project-uploader { type sql; params (default); query "SELECT user.email, user.realname " "FROM user,user_group,groups " "WHERE user_group.user_id=user.user_id " "AND user_group.group_id=groups.group_id " "AND user_group.upload_flags = 'Y' " "AND groups.unix_group_name = '${project}'"; }
Builtin dictionaries are small dictionaries that keep all data
in their params
list. They are designed mainly for testing
purposes.
Look ups in builtin dictionaries are performed as follows:
The query
value is expanded (see query). The resulting
value is used as a key for lookup in params
list.
The list scanned as follows:
Let i be the index of the current element in params
.
Set i to 0.
Get the ith element.
Exact comparison. The key must be exactly equivalent to the dictionary field.
Dictionary field is treated as an fnmatch globbing pattern. See globbing pattern in glob man page.
Dictionary field is treated as a regular expression. Unless configured otherwise by flags (see below), POSIX extended regular expressions are used (see Extended regular expressions in GNU sed).
If that word ends with a comma, the characters following it are flags, defining the type of matching. Allowed flags are:
Flag | Meaning |
---|---|
i | Ignore case |
b | Use basic regular expressions |
For example, the string ‘/exact,i’ specifies case-insensitive exact comparison, the string ‘/regex,bi’ specifies case-insensitive basic regular expression matching, etc.
Go to step ‘INCR’.
Compare the element with the key, using currently selected comparison method.
i+1
through i+n
to the result set. The value for
n is selected as follows:
Dictionary | n |
---|---|
project-owner | 2 |
project-uploader | 4 |
i = i + n
Set i = i + 1
.
If i is greater than the number of elements in param
,
then stop. Otherwise, go to step ‘GETEL’.
For example, the following defines the ‘project-owner’ dictionary, containing data for projects ‘foo’ and ‘bar’:
dictionary project-owner { type builtin; query "${project}"; params ("/exact", "foo", "foo-owner@domain.net", "Foo Admin", "bar", "smith@other.net", "John Smith"); }
As of version 4.0.3 this dictionary is not yet implemented.
This document was generated on January 6, 2021 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.