Automated maintenance should use either "Customer Service", or "Backup" roles..
The database objects represent entities of the project. The following entities are the most important for this project:
The study information is presented with: course, topic, unit, explanation, keyword, reference, problem, test, competition, work-flow, homework, excersize, game, faculty, objective, through-problem, dialogue-of-texts. Any of these can be shared objects.
The users of the system are described with: User, user levels, user groups, user group types.
The financial relations are described with: Company, company types, subscription, subscription types, rate, payments.
Some of the database objects can be managed by users. That includes (but isn't limited to) creating new UMOs, connecting the existing UMOs to other UMOs, modifying UMOs, and access permissions management.
All the different types of the UMO are still stored in the database exactly the same way. This allows to implement the wide range of the operations (stored procedures) covering common (for all UMO types) actions such as creating a new UMO, creating a UMO version, etc. Every UMO has a single (common for all versions of this UMO) 'base' record. Base record owns the UMO version records (one per UMO version), and every version record owns 'content' records (one per content language). This structure allows creating multiple versions per UMO, and every version may provide content in one or more languages.
One of the most important properties of UMO is versioning. That means, that modification of existing published UMO is always done by creating a new version of the UMO, modifying that new version to acceptable state, and publishing it. The old versions of the UMO are kept in the database for future references (if needed). The number of the UMO versions isn't limited. The latest available version is considered as default version, however if there is a need to use an older version of the UMO - it may be used (if permissions are enough, of course).
Access permissions is another important access of the UMOs. UU database defines multiple access permission types that may be assigned to groups. Every UMO connects to one or more groups like 'Students', 'Teachers', 'Administrators' that have different set of permissions. Users can be included into groups to get access permissions to UMOs connected to groups. Users included into 'Administrators' group of the UMO can include or exclude users in/from UMO user groups. The global 'Public' group automatically includes all users. So, if UMO grants any permissions to the 'Public' group then all the users receive these permissions. The most popular permission to grant this way is 'View'.
All UMOs are equal, but some UMOs are more equal than others :) Even though all the UMOs are stored in the database the same way, some of them may have extra actions not typical for others. These actions are implemented as stored UMO-type specific procedures.
Most modern databases allow to define primitive access permissions (SELECT,UPDATE,DELETE) on the table level, or even on the level of table column. The general limitation of this approach is that it doesn't offer any access restrictions on the row level. One of the ways to implement different restrictions for the same user to different records within the same table is to implement all the access to the database tables throw stored procedures while revoking all the access rights from the users on the restricted tables. Stored procedures, in that case, must be created with SECURITY DEFINER attribute. Such stored procedures can be called by regular users but use their creator's permissions when access the tables.
For the regular users (not database administrators), the user information is stored in the person_list table, including known user information along with login name and encrypted password. A user id (a primary key from person_list table, or pl_id) is used as primary user identification. However, any permissions to any object are granted to groups of users and not to particular user. The permissions to an object fro a user can be determined by combining group permissions (from the groups user belongs to) for the object.
Every stored procedure that supports access restrictions must check if the current user has enough permissions to perform an operation. The user credentials are obtained during logon (session start). Logon to the system creates temporary table that stores current user information. Without that table, most of the stored procedures would generate exception requiring to login first.
ACL is implemented on object type and object id basis. The ACL table contains references to the group id, the object type id, and the object (object id), accompanied with the access field. An access field is an integer that contains a bit combination of the available access values:
|access name||access value||Description||Comments|
|No access||0 or NULL||User may not have any access to the object|
|View||1||User may browse and view the content of the object|
|Study||2||User (student) may submit his answer or solution of the problem||Always set for Open Server|
|Modify||4||User may modify the object but not the object access|
|Delete||8||User may delete the object|
|Add Version||16||User may create his own version of the object||Always set for Open Server|
|Link||32||User may link to this object in his objects||Always set for Open Server|
|Translate||64||User may create his own translated version of the object||Always set for Open Server|
|Teach||128||User may teach this version of the object|
|Group administration||256||User may include or exclude other users in the object groups|
|Catalog administration||512||User may edit catalogs|
A particular person has a permission to object that combine permissions of all groups of th object, the person is a member of.
ACL entries are maintained with the stored procedures acl_grant and acl_revoke. Upon execution, stored procedures check if the user has "Modify" right on the object, and then modifies the access for the group. If the required ACL entry doesn't exist it is created.
ACL entries perform slightly differently for the open server and proprietary server configurations. For the open server, the special right bits (Study..Link) are always set, allowing unlimited Study..Link use.
This section lists correct functions to use in order to manipulate specific aspects of the database. Please check here before adding any new functions. Make sure to add info here as you add new procedures. (This section is still incomplete, so make sure to search sources as well).
list_person_umos(person_id, 'COURSE', 'STUDY', 0);(last parameter is limit of courses to return)