UserrightsPage Class Reference
[SpecialPage]

A class to manage user levels rights. More...

Inherits SpecialPage.

List of all members.

Public Member Functions

 __construct ()
 isRestricted ()
 Can be overridden by subclasses with more complicated permissions schemes.
 userCanExecute ($user)
 Checks if the given user (identified by an object) can execute this special page (as defined by $mRestriction).
 userCanChangeRights ($user, $checkIfSelf=true)
 execute ($par)
 Manage forms to be shown according to posted data.
 getSuccessURL ()
 saveUserGroups ($username, $reason= '')
 Save user groups changes in the database.
 addLogEntry ($user, $oldGroups, $newGroups)
 Add a rights log entry for an action.
 editUserGroupsForm ($username)
 Edit user groups membership.
 fetchUser ($username)
 Normalize the input username, which may be local or remote, and return a user (or proxy) object for manipulating it.
 makeGroupNameList ($ids)
 makeGroupNameListForLog ($ids)
 switchForm ()
 Output a form to allow searching for a user.
 changeableGroups ()
 Returns an array of the groups that the user can add/remove.

Protected Member Functions

 splitGroups ($groups)
 Go through used and available groups and return the ones that this form will be able to manipulate based on the current user's system permissions.
 showEditUserGroupsForm ($user, $groups)
 Show the form to edit group memberships.
 showLogFragment ($user, $output)
 Show a rights log fragment for the specified user.

Static Protected Member Functions

static getAllGroups ()
 Returns an array of all groups that may be edited.

Protected Attributes

 $mTarget
 $isself = false

Private Member Functions

 groupCheckboxes ($usergroups)
 Adds a table with checkboxes where you can select what groups to add/remove.
 canRemove ($group)
 canAdd ($group)
 changeableByGroup ($group)
 Returns an array of the groups that a particular group can add/remove.

Static Private Member Functions

static buildGroupLink ($group)
 Format a link to a group description page.


Detailed Description

A class to manage user levels rights.

Definition at line 13 of file SpecialUserrights.php.


Constructor & Destructor Documentation

UserrightsPage::__construct (  ) 

Definition at line 20 of file SpecialUserrights.php.


Member Function Documentation

UserrightsPage::addLogEntry ( user,
oldGroups,
newGroups 
)

Add a rights log entry for an action.

Definition at line 202 of file SpecialUserrights.php.

References $user, $wgRequest, and makeGroupNameListForLog().

Referenced by saveUserGroups().

static UserrightsPage::buildGroupLink ( group  )  [static, private]

Format a link to a group description page.

Parameters:
$group string
Returns:
string

Definition at line 409 of file SpecialUserrights.php.

References User::getGroupName().

Referenced by showEditUserGroupsForm().

UserrightsPage::canAdd ( group  )  [private]

Parameters:
$group string: the name of the group to check
Returns:
bool Can we add the group?

Definition at line 512 of file SpecialUserrights.php.

References changeableGroups().

Referenced by groupCheckboxes().

UserrightsPage::canRemove ( group  )  [private]

Parameters:
$group String: the name of the group to check
Returns:
bool Can we remove the group?

Definition at line 501 of file SpecialUserrights.php.

References changeableGroups().

Referenced by groupCheckboxes().

UserrightsPage::changeableByGroup ( group  )  [private]

Returns an array of the groups that a particular group can add/remove.

Parameters:
$group String: the group to check for whether it can add/remove
Returns:
Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ) , 'add-self' => array( addablegroups to self), 'remove-self' => array( removable groups from self) )

Definition at line 569 of file SpecialUserrights.php.

References $key, $wgAddGroups, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf, $wgRemoveGroups, and getAllGroups().

Referenced by changeableGroups().

UserrightsPage::changeableGroups (  ) 

Returns an array of the groups that the user can add/remove.

Returns:
Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ) , 'add-self' => array( addablegroups to self), 'remove-self' => array( removable groups from self) )

Definition at line 522 of file SpecialUserrights.php.

References $wgUser, changeableByGroup(), User::getAllGroups(), and wfRunHooks().

Referenced by canAdd(), canRemove(), execute(), saveUserGroups(), splitGroups(), and userCanChangeRights().

UserrightsPage::editUserGroupsForm ( username  ) 

Edit user groups membership.

Parameters:
$username String: name of the user.

Definition at line 220 of file SpecialUserrights.php.

References $user, $username, $wgOut, fetchUser(), showEditUserGroupsForm(), and showLogFragment().

Referenced by execute().

UserrightsPage::execute ( par  ) 

Manage forms to be shown according to posted data.

Depending on the submit button used, call a form or a save function.

Parameters:
$par Mixed: string if any subpage provided, else null

Reimplemented from SpecialPage.

Definition at line 47 of file SpecialUserrights.php.

References $reason, $url, $wgOut, $wgRequest, $wgUser, changeableGroups(), editUserGroupsForm(), getSuccessURL(), SpecialPage::outputHeader(), saveUserGroups(), SpecialPage::setHeaders(), switchForm(), userCanChangeRights(), and wfReadOnly().

UserrightsPage::fetchUser ( username  ) 

Normalize the input username, which may be local or remote, and return a user (or proxy) object for manipulating it.

Side effects: error output for invalid access

Returns:
mixed User, UserRightsProxy, or null

Definition at line 244 of file SpecialUserrights.php.

References $database, $name, $user, $username, $wgOut, $wgUser, $wgUserrightsInterwikiDelimiter, UserRightsProxy::newFromName(), User::newFromName(), UserRightsProxy::validDatabase(), UserRightsProxy::whoIs(), and User::whoIs().

Referenced by editUserGroupsForm(), and saveUserGroups().

static UserrightsPage::getAllGroups (  )  [static, protected]

Returns an array of all groups that may be edited.

Returns:
array Array of groups that may be edited.

Definition at line 420 of file SpecialUserrights.php.

Referenced by changeableByGroup(), groupCheckboxes(), and saveUserGroups().

UserrightsPage::getSuccessURL (  ) 

Definition at line 121 of file SpecialUserrights.php.

References SpecialPage::getTitle().

Referenced by execute().

UserrightsPage::groupCheckboxes ( usergroups  )  [private]

Adds a table with checkboxes where you can select what groups to add/remove.

Parameters:
$usergroups Array: groups the user belongs to
Returns:
string XHTML table element with checkboxes

Definition at line 430 of file SpecialUserrights.php.

References $text, canAdd(), canRemove(), Xml::checkLabel(), Xml::closeElement(), getAllGroups(), User::getGroupMember(), Xml::openElement(), Xml::tags(), wfMsg(), and wfMsgHtml().

Referenced by showEditUserGroupsForm().

UserrightsPage::isRestricted (  ) 

Can be overridden by subclasses with more complicated permissions schemes.

Returns:
bool Should the page be displayed with the restricted-access pages?

Reimplemented from SpecialPage.

Definition at line 24 of file SpecialUserrights.php.

UserrightsPage::makeGroupNameList ( ids  ) 

Definition at line 300 of file SpecialUserrights.php.

References wfMsgForContent().

Referenced by makeGroupNameListForLog().

UserrightsPage::makeGroupNameListForLog ( ids  ) 

Definition at line 308 of file SpecialUserrights.php.

References makeGroupNameList().

Referenced by addLogEntry().

UserrightsPage::saveUserGroups ( username,
reason = '' 
)

Save user groups changes in the database.

Data comes from the editUserGroupsForm() form function

Parameters:
$username String: username to apply changes to.
$reason String: reason for group change
Returns:
null

Definition at line 133 of file SpecialUserrights.php.

References $user, $username, $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf, $wgRequest, $wgUser, addLogEntry(), changeableGroups(), fetchUser(), getAllGroups(), wfDebug(), and wfRunHooks().

Referenced by execute().

UserrightsPage::showEditUserGroupsForm ( user,
groups 
) [protected]

Show the form to edit group memberships.

Parameters:
$user User or UserRightsProxy you're editing
$groups Array: Array of groups the user is in

Definition at line 360 of file SpecialUserrights.php.

References $user, $wgLang, $wgOut, $wgUser, buildGroupLink(), Xml::closeElement(), Xml::element(), SpecialPage::getTitle(), groupCheckboxes(), Xml::hidden(), Xml::input(), Xml::label(), Xml::openElement(), Xml::submitButton(), Xml::tags(), wfEscapeWikiText(), wfMsg(), wfMsgExt(), and wfMsgHtml().

Referenced by editUserGroupsForm().

UserrightsPage::showLogFragment ( user,
output 
) [protected]

Show a rights log fragment for the specified user.

Parameters:
$user User to show log for
$output OutputPage to use

Definition at line 632 of file SpecialUserrights.php.

References $output, $user, Xml::element(), LogPage::logName(), and LogEventsList::showLogExtract().

Referenced by editUserGroupsForm().

UserrightsPage::splitGroups ( groups  )  [protected]

Go through used and available groups and return the ones that this form will be able to manipulate based on the current user's system permissions.

Parameters:
$groups Array: list of groups the given user is in
Returns:
Array: Tuple of addable, then removable groups

Definition at line 341 of file SpecialUserrights.php.

References changeableGroups().

UserrightsPage::switchForm (  ) 

Output a form to allow searching for a user.

Definition at line 319 of file SpecialUserrights.php.

References $wgOut, $wgScript, Xml::closeElement(), Xml::element(), SpecialPage::getTitle(), Xml::hidden(), Xml::inputLabel(), Xml::openElement(), Xml::submitButton(), and wfMsg().

Referenced by execute().

UserrightsPage::userCanChangeRights ( user,
checkIfSelf = true 
)

Definition at line 32 of file SpecialUserrights.php.

References changeableGroups().

Referenced by execute(), and userCanExecute().

UserrightsPage::userCanExecute ( user  ) 

Checks if the given user (identified by an object) can execute this special page (as defined by $mRestriction).

Can be overridden by sub- classes with more complicated permissions schemes.

Parameters:
User $user The user to check
Returns:
bool Does the user have permission to view the page?

Reimplemented from SpecialPage.

Definition at line 28 of file SpecialUserrights.php.

References $user, and userCanChangeRights().


Member Data Documentation

UserrightsPage::$isself = false [protected]

Definition at line 18 of file SpecialUserrights.php.

UserrightsPage::$mTarget [protected]

Definition at line 17 of file SpecialUserrights.php.


The documentation for this class was generated from the following file:

Generated on Sat Sep 5 02:08:50 2009 for MediaWiki by  doxygen 1.5.9