Roxen.git
/
server
/
modules
/
examples
/
userdb_ex.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/modules/examples/userdb_ex.pike:21:
constant name = "example"; //! The name of the userdatbase, used to identify it from modules or //! htaccess files or similar that wants to authenticate against a //! specific database instead of against any of them. //! //! The name should be reasonably short and should be unique, however, //! nothing will break if more than one database has the same name, it //! will be impossible to know which of them will be used when //! authentication is done, however..
-
constant cvs_version="$Id: userdb_ex.pike,v 1.
7
2004
/
06
/
30
16
:
58
:
58
mast Exp $";
+
constant cvs_version="$Id: userdb_ex.pike,v 1.
8
2008
/
08
/
15
12
:
33
:
54
mast Exp $";
LocaleString module_name = LOCALE(1,"RefDoc for MODULE_USERDB"); LocaleString module_doc = LOCALE(2,"This module does nothing special, it implements a simple " "user database with the passwords and usernames in a string list, " "but its inlined documentation gets imported into the Roxen " "programmer manual.\n" "You definetely don't want to use this module in your virtual " "servers, since anybody with access to your admin interface or " "server configuration file automatically gains access to all " "your passwords. For a budding roxen programmer, the module " "however does show the basics of making a user database module.");
-
static
void create()
+
protected
void create()
// Define a variable that will hold all the users. Only the user id // (the short name) and the password are defined in this list, but it // could easily be extended to include more information. { defvar("users", Variable.StringList(({}), VAR_INITIAL, LOCALE(3,"Users and Passwords"), LOCALE(4,"A list of username:password " "pairs."))); } class ExUser //! Each user in the new userdatabase system is represented by a user //! object. {
-
static
string id;
-
static
string pw;
+
protected
string id;
+
protected
string pw;
// Passed when this object is created. This is not really enough to // implement all functions below, but it's enough to fulfill the // minimum implementation. inherit User; //! This inherit includes prototypes and some implementations of //! functions this object has to implement. The default //! implementations, if any, are noted below.
-
static
void create( string _id, string _pw )
+
protected
void create( string _id, string _pw )
// Set the variables from the constructor arguments and call the // create method in the parent class. { id = _id; pw = _pw; ::create( this_module() ); } string name() //! The name of the user. This is the short name that is used to log
Roxen.git/server/modules/examples/userdb_ex.pike:156:
} } class ExGroup //! ExGroup. { inherit Group; //! All groups should inherit the group class.
-
static
void create()
+
protected
void create()
// Call the constructor in the parent class. { ::create( this_module() ); } string name() //! The group name { // Our one and only group is named example.
Roxen.git/server/modules/examples/userdb_ex.pike:187:
//! All users that are members of this group. The default //! implementation loops over all users handled by the user database //! and looks for users with the same gid as this group. { // All our users are members of this group, the default // implementation would work, bit it would be rather inefficient. return list_users(0); } }
-
static
ExGroup the_one_and_only_group = ExGroup();
+
protected
ExGroup the_one_and_only_group = ExGroup();
// There can be only one. array(string) list_users( RequestID dummy ) //! Return a list of all users handled by this database module. { return column( map( query( "users" ), `/, ":" ), 0 ); } array(string) list_groups( RequestID id ) //! Return a list of all groups handled by this database module.