Comments: on this page. Click to read or post your own.

Class Member

Description

The member class which represents the users of the system

Located in /sapphire/security/Member.php (line 7)

Object
   |
   --ViewableData
      |
      --DataObject
         |
         --Member
Direct descendents
Class Description
GroupTest_Member The member class which represents the users of the system
DataObjectTest_Player The member class which represents the users of the system
FormScaffolderTest_Author The member class which represents the users of the system
Variable Summary
static mixed $belongs_many_many
static mixed $db
static mixed $default_sort
static mixed $has_one
static mixed $indexes
static mixed $many_many
static mixed $many_many_extraFields
static mixed $password_expiry_days
static mixed $password_validator
static array $searchable_fields
static mixed $summary_fields
Method Summary
static void autoLogin ()
static void create_new_password ()
static bool|Member currentUser ()
static int currentUserID ()
static void init_db_fields ()
static void lock_out_after_incorrect_logins ( $numLogins)
static SQLMap mapInCMSGroups ([array $groups = null])
static SQLMap mapInGroups ([mixed $groups = null])
static void member_from_autologinhash ( $RAW_hash, [bool $login = false])
static void password_validator ()
static void session_regenerate_id ()
static void set_password_expiry ( $days)
static void set_password_validator ( $pv)
void canEdit ()
void changePassword ( $password)
bool checkPassword (string $password)
void fieldLabels ()
void generateAutologinHash ([int $lifetime = 2])
string getName ()
string getTitle ()
void getValidator ()
bool inGroup (int|Group|string $group)
bool inGroups ( $groups)
Returns isAdmin ()
void isInGroup ( $groupID)
void isLockedOut ()
void logIn ([bool $remember = false])
void logOut ()
SQLMap map ([string $filter = ""], [string $sort = ""], [string $blank = ""])
array memberNotInGroups (array $groupList, [array $memberGroups = null])
void onAfterWrite ()
void onBeforeWrite ()
void sendInfo ([string $type = 'signup'], [array $data = null])
void setBlacklistedEmail (bool $val)
void setName (string $name)
void splitName (string $name)
void validate ()
Variables
static mixed $belongs_many_many = array(
"Groups" => "Group",
)
(line 28)

Redefinition of:
DataObject::$belongs_many_many
The inverse side of a many-many relationship.

Redefined in descendants as:
static mixed $db = array(
'FirstName' => "Varchar",
'Surname' => "Varchar",
'Email' => "Varchar",
'Password' => "Varchar(64)", // support for up to SHA256!
'RememberLoginToken' => "Varchar(50)",
'NumVisit' => "Int",
'LastVisited' => 'SSDatetime',
'Bounced' => 'Boolean', // Note: This does not seem to be used anywhere.
'AutoLoginHash' => 'Varchar(30)',
'AutoLoginExpired' => 'SSDatetime',
'BlacklistedEmail' => 'Boolean',
'PasswordEncryption' => "Enum('none', 'none')",
'Salt' => 'Varchar(50)',
'PasswordExpiry' => 'Date',
'LockedOutUntil' => 'SSDatetime',
'Locale' => 'Varchar(6)',
)
(line 9)

Redefinition of:
DataObject::$db
Database field definitions.
static mixed $default_sort = "Surname, FirstName" (line 38)

Redefinition of:
DataObject::$default_sort
The default sort expression. This will be inserted in the ORDER BY clause of a SQL query if no other sort expression is provided.
static mixed $has_one = array() (line 32)

Redefinition of:
DataObject::$has_one
one-to-one relationship definitions.

Redefined in descendants as:
static mixed $indexes = array(
'Email' => true,
'AutoLoginHash' => 'unique (AutoLoginHash)'
)
(line 40)

Redefinition of:
DataObject::$indexes
If a field is in this array, then create a database index on that field. This is a map from fieldname to index type.
static mixed $lock_out_after_incorrect_logins = null (line 81)
  • access: protected
static mixed $many_many = array() (line 34)

Redefinition of:
DataObject::$many_many
many-many relationship definitions.
static mixed $many_many_extraFields = array() (line 36)

Redefinition of:
DataObject::$many_many_extraFields
Extra fields to include on the connecting many-many table.
static mixed $notify_password_change = false (line 45)
static mixed $password_expiry_days = null (line 79)

The number of days that a password should be valid for.

By default, this is null, which means that passwords never expire

  • access: protected
static mixed $password_validator = null (line 73)

PasswordValidator object for validating user's password

  • access: protected
static array $searchable_fields = array(
'FirstName',
'Surname',
'Email',
)
(line 58)

All searchable database columns in this object, currently queried with a "column LIKE '%keywords%' statement.

  • todo: Generic implementation of $searchable_fields on DataObject, with definition for different searching algorithms (LIKE, FULLTEXT) and default FormFields to construct a searchform.

Redefinition of:
DataObject::$searchable_fields
Default list of fields that can be scaffolded by the ModelAdmin search interface.
static mixed $summary_fields = array(
'FirstName',
'Surname',
'Email',
)
(line 64)

Redefinition of:
DataObject::$summary_fields
Provides a default list of fields to be used by a 'summary' view of this object.

Inherited Variables

Inherited from DataObject

DataObject::$ancestry
DataObject::$api_access
DataObject::$brokenOnDelete
DataObject::$brokenOnWrite
DataObject::$cache_get_one
DataObject::$casting
DataObject::$changed
DataObject::$componentCache
DataObject::$components
DataObject::$defaults
DataObject::$default_records
DataObject::$destroyed
DataObject::$field_labels
DataObject::$has_many
DataObject::$original
DataObject::$plural_name
DataObject::$record
DataObject::$singular_name

Inherited from ViewableData

ViewableData::$castingHelperPair_cache
ViewableData::$customisedObj
ViewableData::$failover
ViewableData::$iteratorPos
ViewableData::$iteratorTotalItems
ViewableData::$namedAs
ViewableData::$parent
ViewableData::$_natural_cache
ViewableData::$_object_cache
ViewableData::$_xml_cache

Inherited from Object

Object::$builtInMethods
Object::$class
Object::$classConstructed
Object::$extensions
Object::$extension_instances
Object::$extraMethods
Object::$extraStatics
Object::$statics
Object::$static_cached
Methods
static method autoLogin (line 214)

Log the user in if the "remember login" cookie is set

The remember login token will be changed on every successful auto-login.

static void autoLogin ()
static method create_new_password (line 420)
static void create_new_password ()
static method currentUser (line 361)

Returns the current logged in user

  • return: Returns the member object of the current logged in user or FALSE.
static bool|Member currentUser ()
static method currentUserID (line 379)

Get the ID of the current logged in user

  • return: Returns the ID of the current logged in user or 0.
static int currentUserID ()
static method init_db_fields (line 95)

This method is used to initialize the static database members

Since PHP doesn't support any expressions for the initialization of static member variables we need a method that does that.

This method adds all supported encryption algorithms to the PasswordEncryption Enum field.

  • todo: Maybe it would be useful to define this in DataObject and call it automatically?
  • access: public
static void init_db_fields ()
static method lock_out_after_incorrect_logins (line 161)

Configure the security system to lock users out after this many incorrect logins

static void lock_out_after_incorrect_logins ( $numLogins)
  • $numLogins
static method mapInCMSGroups (line 739)

Get a map of all members in the groups given that have CMS permissions

If no groups are passed, all groups with CMS permissions will be used.

  • return: Returns a map of all members in the groups given that have CMS permissions.
  • access: public
static SQLMap mapInCMSGroups ([array $groups = null])
  • array $groups: Groups to consider or NULL to use all groups with CMS permissions.
static method mapInGroups (line 705)

Get a member SQLMap of members in specific groups

  • return: Returns an SQLMap that returns all Member data.
  • see: Member::map()
  • todo: Improve documentation of this function! (Markus)
  • access: public
static SQLMap mapInGroups ([mixed $groups = null])
  • mixed $groups: Optional groups to include in the map. If NULL is passed, all groups are returned, i.e. map() will be called.
static method member_from_autologinhash (line 289)

Return the member for the auto login hash

static void member_from_autologinhash ( $RAW_hash, [bool $login = false])
  • bool $login: Should the member be logged in?
  • $RAW_hash
static method password_validator (line 146)

Returns the current PasswordValidator

static void password_validator ()
static method session_regenerate_id (line 128)

Regenerate the session_id.

This wrapper is here to make it easier to disable calls to session_regenerate_id(), should you need to. They have caused problems in certain quirky problems (such as using the Windmill 0.3.6 proxy).

static void session_regenerate_id ()
static method set_password_expiry (line 154)

Set the number of days that a password should be valid for.

Set to null (the default) to have passwords never expire.

static void set_password_expiry ( $days)
  • $days
static method set_password_validator (line 139)

Set a PasswordValidator object to use to validate member's passwords.

static void set_password_validator ( $pv)
  • $pv
canEdit (line 884)
void canEdit ()

Redefinition of:
DataObject::canEdit()
changePassword (line 912)
void changePassword ( $password)
  • $password
checkPassword (line 107)

Check if the passed password matches the stored one

  • return: Returns TRUE if the passed password is valid, otherwise FALSE.
  • access: public
bool checkPassword (string $password)
  • string $password: The clear text password to check
fieldLabels (line 863)
void fieldLabels ()

Redefinition of:
DataObject::fieldLabels()
Get any user defined searchable fields labels that exist. Allows overriding of default field names in the form interface actually presented to the user.
generateAutologinHash (line 271)

Generate an auto login hash

This creates an auto login hash that can be used to reset the password.

  • todo: Make it possible to handle database errors such as a "duplicate key" error
void generateAutologinHash ([int $lifetime = 2])
  • int $lifetime: The lifetime of the auto login hash in days (by default 2 days)
getCMSFields (line 809)

Return a FieldSet of fields that would appropriate for editing this member.

  • return: Return a FieldSet of fields that would appropriate for editing this member.
  • access: public
FieldSet getCMSFields ()

Redefinition of:
DataObject::getCMSFields()
Centerpiece of every data administration interface in Silverstripe, which returns a FieldSet suitable for a Form object.

Redefined in descendants as:
getMemberFormFields (line 338)

Returns the fields for the member form - used in the registration/profile module.

It should return fields that are editable by the admin and the logged-in user.

  • return: Returns a FieldSet containing the fields for the member form.
FieldSet getMemberFormFields ()
getName (line 596)

Get the complete name of the member

  • return: Returns the first- and surname of the member.
  • access: public
string getName ()
getTitle (line 584)

Get the complete name of the member

  • return: Returns the first- and surname of the member. If the ID of the member is equal 0, only the surname is returned.
  • access: public
string getTitle ()

Redefinition of:
DataObject::getTitle()
Standard implementation of a title/label for a specific
getValidator (line 350)
void getValidator ()
Groups (line 636)

Get a "many-to-many" map that holds for all members their group memberships

  • return: Returns a map holding for all members their group memberships.
  • access: public
Member_GroupSet Groups ()
inGroup (line 543)

Check if the member is in the given group

  • return: Returns TRUE if the member is in the given group, otherwise FALSE.
  • access: public
bool inGroup (int|Group|string $group)
  • int|Group|string $group: Group instance, Group Code or ID
inGroups (line 529)

Check if the member is in one of the given groups

  • return: Returns TRUE if the member is in one of the given groups, otherwise FALSE.
  • access: public
bool inGroups ( $groups)
  • array $groups: Groups to check
isAdmin (line 572)

Returns true if this user is an administrator.

Administrators have access to everything.

  • return: TRUE if this user is an administrator.
  • TODO: Should this function really exist? Is not isAdmin() the only right name for this?
Returns isAdmin ()
isInGroup (line 950)
  • deprecated: 2.3 Use inGroup()
  • access: public
void isInGroup ( $groupID)
  • $groupID
isLockedOut (line 118)

Returns true if this user is locked out

  • access: public
void isLockedOut ()
isPasswordExpired (line 166)
void isPasswordExpired ()
logIn (line 176)

Logs this member in

void logIn ([bool $remember = false])
  • bool $remember: If set to TRUE, the member will be logged in automatically the next time.
logOut (line 245)

Logs this member out.

void logOut ()
map (line 680)

Get member SQLMap

  • return: Returns an SQLMap that returns all Member data.
  • todo: Improve documentation of this function! (Markus)
  • access: public
SQLMap map ([string $filter = ""], [string $sort = ""], [string $blank = ""])
  • string $filter: Filter for the SQL statement (WHERE clause)
  • string $sort: Sorting function (ORDER clause)
  • string $blank: Shift a blank member in the items
memberNotInGroups (line 788)

Get the groups in which the member is NOT in

When passed an array of groups, and a component set of groups, this function will return the array of groups the member is NOT in.

  • return: Groups in which the member is NOT in.
  • access: public
array memberNotInGroups (array $groupList, [array $memberGroups = null])
  • array $groupList: An array of group code names.
  • array $memberGroups: A component set of groups (if set to NULL, $this->groups() will be used)
onAfterWrite (line 513)
void onAfterWrite ()

Redefinition of:
DataObject::onAfterWrite()
Event handler called after writing to the database.
onBeforeWrite (line 447)

Event handler called before writing to the database

If an email's filled out look for a record with the same email and if found update this record to merge with that member.

void onBeforeWrite ()

Redefinition of:
DataObject::onBeforeWrite()
Event handler called before writing to the database.
registerFailedLogin (line 932)

Tell this member that someone made a failed attempt at logging in as them.

This can be used to lock the user out temporarily if too many failed attempts are made.

void registerFailedLogin ()
requireDefaultRecords (line 875)
void requireDefaultRecords ()

Redefinition of:
DataObject::requireDefaultRecords()
Add default records to database. This function is called whenever the database is built, after the database tables have all been created. Overload this to add default records when the database is built, but make sure you call parent::requireDefaultRecords().
sendInfo (line 308)

Send signup, change password or forgot password informations to an user

void sendInfo ([string $type = 'signup'], [array $data = null])
  • string $type: Information type to send ("signup", "changePassword" or "forgotPassword")
  • array $data: Additional data to pass to the email (can be used in the template)
setBlacklistedEmail (line 400)

Add the members email address to the blacklist

With this method the blacklisted email table is updated to ensure that no promotional material is sent to the member (newsletters). Standard system messages are still sent such as receipts.

void setBlacklistedEmail (bool $val)
  • bool $val: Set to TRUE if the address should be added to the blacklist, otherwise to FALSE.
setName (line 609)

Set first- and surname

This method assumes that the last part of the name is the surname, e.g. A B C will result in firstname A B and surname C

  • access: public
void setName (string $name)
  • string $name: The name
splitName (line 622)

Alias for setName

void splitName (string $name)
  • string $name: The name
validate (line 894)

Validate this member object.

void validate ()

Redefinition of:
DataObject::validate()
Validate the current object.

Inherited Methods

Inherited From DataObject

DataObject::__construct()
DataObject::baseTable()
DataObject::buildDataObjectSet()
DataObject::buildSQL()
DataObject::can()
DataObject::canCreate()
DataObject::canDelete()
DataObject::canEdit()
DataObject::canView()
DataObject::castedUpdate()
DataObject::context_obj()
DataObject::createComponent()
DataObject::customDatabaseFields()
DataObject::data()
DataObject::databaseFields()
DataObject::databaseIndexes()
DataObject::db()
DataObject::dbObject()
DataObject::debug()
DataObject::defaultSearchFilters()
DataObject::defineMethods()
DataObject::delete()
DataObject::delete_by_id()
DataObject::destroy()
DataObject::disable_subclass_access()
DataObject::duplicate()
DataObject::enable_subclass_access()
DataObject::exists()
DataObject::extendedSQL()
DataObject::fieldExists()
DataObject::fieldLabel()
DataObject::fieldLabels()
DataObject::filledOut()
DataObject::flushCache()
DataObject::forceChange()
DataObject::get()
DataObject::getAllFields()
DataObject::getChangedFields()
DataObject::getClassAncestry()
DataObject::getCMSFields()
DataObject::getComponent()
DataObject::getComponentJoinField()
DataObject::getComponents()
DataObject::getComponentsQuery()
DataObject::getDefaultSearchContext()
DataObject::getField()
DataObject::getFrontEndFields()
DataObject::getManyManyComponents()
DataObject::getManyManyComponentsQuery()
DataObject::getManyManyFilter()
DataObject::getManyManyJoin()
DataObject::getReverseAssociation()
DataObject::getTitle()
DataObject::get_by_id()
DataObject::get_by_url()
DataObject::get_one()
DataObject::hasDatabaseField()
DataObject::hasField()
DataObject::hasOwnTableDatabaseField()
DataObject::has_many()
DataObject::has_one()
DataObject::i18n_plural_name()
DataObject::i18n_singular_name()
DataObject::inheritedDatabaseFields()
DataObject::instance_get()
DataObject::instance_get_one()
DataObject::isEmpty()
DataObject::isInDB()
DataObject::listOfFields()
DataObject::many_many()
DataObject::merge()
DataObject::newClassInstance()
DataObject::onAfterWrite()
DataObject::onBeforeDelete()
DataObject::onBeforeWrite()
DataObject::plural_name()
DataObject::populateDefaults()
DataObject::relObject()
DataObject::requireDefaultRecords()
DataObject::requireTable()
DataObject::scaffoldFormFields()
DataObject::scaffoldSearchFields()
DataObject::searchableFields()
DataObject::setCastedField()
DataObject::setClassName()
DataObject::setComponent()
DataObject::setField()
DataObject::set_context_obj()
DataObject::singular_name()
DataObject::summaryFields()
DataObject::toMap()
DataObject::update()
DataObject::validate()
DataObject::write()
DataObject::writeComponents()
DataObject::writeWithoutVersion()

Inherited From ViewableData

ViewableData::ATT_val()
ViewableData::BaseHref()
ViewableData::buildCastingHelperCache()
ViewableData::cachedCall()
ViewableData::castingHelper()
ViewableData::castingHelperPair()
ViewableData::castingObjectCreator()
ViewableData::castingObjectCreatorPair()
ViewableData::CSSClasses()
ViewableData::CurrentMember()
ViewableData::CurrentPage()
ViewableData::customise()
ViewableData::Debug()
ViewableData::defineMethods()
ViewableData::escapeTypeForField()
ViewableData::Even()
ViewableData::EvenOdd()
ViewableData::First()
ViewableData::FirstLast()
ViewableData::getField()
ViewableData::getIterator()
ViewableData::getXMLValues()
ViewableData::hasField()
ViewableData::HasPerm()
ViewableData::hasValue()
ViewableData::i18nLocale()
ViewableData::IsAjax()
ViewableData::iteratorProperties()
ViewableData::JS_val()
ViewableData::Last()
ViewableData::Me()
ViewableData::Middle()
ViewableData::MiddleString()
ViewableData::obj()
ViewableData::Odd()
ViewableData::Pos()
ViewableData::RAW_val()
ViewableData::renderWith()
ViewableData::SecurityID()
ViewableData::setCustomisedObj()
ViewableData::setField()
ViewableData::SQL_val()
ViewableData::ThemeDir()
ViewableData::Top()
ViewableData::TotalItems()
ViewableData::val()
ViewableData::XML_val()
ViewableData::__get()
ViewableData::__isset()
ViewableData::__set()

Inherited From Object

Object::__construct()
Object::addMethodsFrom()
Object::addStaticVars()
Object::addWrapperMethod()
Object::add_extension()
Object::allMethodNames()
Object::buildMethodList()
Object::cacheToFile()
Object::cacheToFileWithArgs()
Object::create()
Object::createMethod()
Object::defineMethods()
Object::exists()
Object::extend()
Object::extInstance()
Object::getCustomClass()
Object::hasExtension()
Object::hasMethod()
Object::invokeWithExtensions()
Object::is_a()
Object::loadCache()
Object::parentClass()
Object::sanitiseCachename()
Object::saveCache()
Object::set_stat()
Object::set_uninherited()
Object::stat()
Object::strong_create()
Object::uninherited()
Object::useCustomClass()
Object::__call()
Object::__toString()
blog comments powered by Disqus

Documentation generated on Sun, 19 Oct 2008 06:42:51 +1300 by phpDocumentor 1.3.2