How to register users from register

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Set the connection information of database)
(Enable modules)
Line 40: Line 40:
 
  register.yate=true
 
  register.yate=true
  
 +
 +
===Register users ===
 +
 +
See an example of [[Register_Database_Schema|database schema]] to keep the users.
 +
 +
In [[Register|register.conf]] in section '''[general]''' the user.register must be enabled.
 +
 +
[general]
 +
user.register=yes
 +
 +
[user.register]
 +
query=UPDATE users SET location='${data}',expires=CURRENT_TIMESTAMP + INTERVAL '${expires} s' WHERE username='${username}'
  
 
'''See also'''
 
'''See also'''

Revision as of 11:40, 5 April 2013

Suppose that you have this scenario: you want to register users from a database using PostgreSQL.

Contents

Create database

After creating your database with the tables that you need (here is an example of a database schema), you have to tell Yate what database to use.

Configure database in Yate

Set the name of the database

The module used is register.conf and in section [default] the name of the database connection must be set:

[default]
account=Database_Name

Set the connection information of database

In PostgreSQL configuration file: pgsqldb.conf we have to set the connection data for this database in a section that will have the same name as the account settled in register.conf:

[Database_Name]
host=
database=
user=
password=
  

After "=" you have to write your connection information.

Enable modules

Also, in your yate.conf these modules should be enabled by hand, if you set modload=disable

[modules]
; This section should hold one line for each module whose loading behaviour
;  is to be changed from the default specified by modload= in section [general]
; Each line has to be of the form:
;   modulename.yate=boolean
; Note that modules can be located only in the module directory so no path
;  information should be specified
pgsqldb.yate=true
register.yate=true


Register users

See an example of database schema to keep the users.

In register.conf in section [general] the user.register must be enabled.

[general]
user.register=yes

[user.register]
query=UPDATE users SET location='${data}',expires=CURRENT_TIMESTAMP + INTERVAL '${expires} s' WHERE username='${username}'

See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers