Topincs supports any number of user groups. Every user account belongs to exactly one user group. The behavior of an online database can be tailored by the administrator to match the requirements and access rights of a user group. Such an adjustment creates an online application with a completely different appearance and work flow than the default Topincs online database.
This section explains how to manually create new users accounts, activate and deacitvate them. It also covers how to programmatically create new users accounts and tie them to a domain topic representing the user with a service or a trigger.
Hint: Do not confuse the predefined user group called User with the predefined abstract topic type of the same name. It will be introduced shortly.
Initially every store has three predefined user groups:
You can create any number of additional user groups via the admin menu Admin menu > User management > Index. The behavior of the online database completely depends on which user group the user account is a member of.
A user may be represented in the online database by a domain topic. It is completely up to the administrator to decide on the name of the topic type and the properties. In order to be able to associate a user account to the topic representing the user, the topic type must subtype the predefined abstract topic type User.
Hint: Creating a tie between a user account and a user brings in the notion of ownership. His or her items can be reached from the user account by using the Topincs API.
The distinction between user account and user is important and must be well understood. Every Topincs online database has user accounts. Not all of them connect these to a domain topic representing the user. This connection becomes important when you need to create topic access filters to decide whether an user has access to a topic or when the information you display in services should depend on the user. Here are some examples:
Manually the adminstrator can edit the fact sheet of the user account and assign the user or edit the user and assign the user account. Setting up user managament infrastructure for other user groups is preferable in more complex system with lots of users since it allows to administrator to completely delegate user management to another user group.
When there is no need to extend the user groups beyond an administrator and an ordinary user, the built in default registration can be used. This will create user accounts in the predefined user group user. The settings allow the admin to individually allow or reject the registration or to simply allow anyone to register. Get in touch with the Topincs team to configure your database, if you wish to use this feature.
The following image illustrates the relationships between user group, user account, and user. User group and user are schematic topic types and thus solely in the responsibility and access of the administrator. These topic types are predefined. The administrator has to create one or more topic types of which instances will represent users in the domain. Our example has two domain topic types (sales rep and regional head) which instances may be connected to user accounts. They are subtypes of the predefined topic type User.
Hint: Rectangles are topic types. Black dots are topics. Domain topic types are colorful. Schematic topic types grey.
Creating a new user account is straight forward. Goto the user management index Admin menu > User management > Index and create a new user account. When you are finished you will see Activate and Deactivate in the topic menu. Activate optionally sends an email with the access data to the user. The deactivation becomes only effective after the user has finished his current session.
It is a bit more complicated to hand off user management to another user group entirely and also have complete control over the process, e.g. send a custom email.
Hint: Item triggers are the only way to create user accounts during data import.
The task can be achieved by either using a service or a trigger. A service should be used if the user account should be activated manually. A form trigger is preferable over an item trigger. If a new topic (e.g. registration, player, sales rep) is created, a trigger should create a user account. A user account needs a user name, an user group, an email address and optionally a domain topic representing the user.
API reference
// A predefined domain class makes user management easy.
// You need to require it before use.
require_once("api/TopincsUserAccount.php");
//The service receives the rep and his password as parameters.
$rep = $p->get("rep");
$pw = $p->get("pw");
// The topic type of $rep must be a subtype of user for this to work.
$ua = $rep->get_topincs_user_account();
if ($ua === null) {
$ua = TopincsUserAccount::create(
// The id of the employee serves as a username.
$rep->get_employee_id(),
// 777 is the system id of the custom user group.
"id:777",
$rep->get_email(),
// Tie the new user account to the rep.
$rep
);
}
$ua->activate($pw);
// The rep can log in now.
redirect($rep->href());
This page cannot be displayed in your browser. Use Firefox, Opera, Safari, or Chrome instead.
Saving …