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.
 doSaveUserGroups ($user, $add, $remove, $reason= '')
 Save user groups changes in the database.
 addLogEntry ($user, $oldGroups, $newGroups, $reason)
 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 $wgUser->changeableGroups().

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)

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,
reason 
)

Add a rights log entry for an action.

Definition at line 230 of file SpecialUserrights.php.

References makeGroupNameListForLog().

Referenced by doSaveUserGroups().

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

Format a link to a group description page.

Parameters:
$group string
Returns:
string

Definition at line 455 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 559 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 548 of file SpecialUserrights.php.

References changeableGroups().

Referenced by groupCheckboxes().

UserrightsPage::changeableGroups (  ) 

Returns $wgUser->changeableGroups().

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 $wgUser.

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

UserrightsPage::doSaveUserGroups ( user,
add,
remove,
reason = '' 
)

Save user groups changes in the database.

Parameters:
$user User object
$add Array of groups to add
$remove Array of groups to remove
$reason String: reason for group change
Returns:
Array: Tuple of added, then removed groups

Definition at line 178 of file SpecialUserrights.php.

References $isself, $wgUser, addLogEntry(), changeableGroups(), wfDebug(), and wfRunHooks().

Referenced by saveUserGroups().

UserrightsPage::editUserGroupsForm ( username  ) 

Edit user groups membership.

Parameters:
$username String: name of the user.

Definition at line 247 of file SpecialUserrights.php.

References $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 $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 WikiErrorMsg

Definition at line 272 of file SpecialUserrights.php.

References $name, $wgUser, $wgUserrightsInterwikiDelimiter, User::getCanonicalName(), UserRightsProxy::newFromName(), User::newFromName(), UserRightsProxy::validDatabase(), wfWikiID(), 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 466 of file SpecialUserrights.php.

Referenced by groupCheckboxes(), and saveUserGroups().

UserrightsPage::getSuccessURL (  ) 

Definition at line 129 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 476 of file SpecialUserrights.php.

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

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 333 of file SpecialUserrights.php.

References wfMsgForContent().

Referenced by makeGroupNameListForLog().

UserrightsPage::makeGroupNameListForLog ( ids  ) 

Definition at line 341 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 141 of file SpecialUserrights.php.

References $wgGroupsAddToSelf, $wgGroupsRemoveFromSelf, $wgOut, $wgRequest, $wgUser, doSaveUserGroups(), fetchUser(), and getAllGroups().

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 395 of file SpecialUserrights.php.

References $wgLang, $wgOut, $wgUser, buildGroupLink(), Xml::closeElement(), Xml::element(), Autopromote::getAutopromoteGroups(), 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 580 of file SpecialUserrights.php.

References $output, 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 374 of file SpecialUserrights.php.

References changeableGroups().

UserrightsPage::switchForm (  ) 

Output a form to allow searching for a user.

Definition at line 352 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 userCanChangeRights().


Member Data Documentation

UserrightsPage::$isself = false [protected]

Definition at line 18 of file SpecialUserrights.php.

Referenced by doSaveUserGroups().

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 Apr 30 22:57:52 2011 for MediaWiki by  doxygen 1.5.9