MediaWiki  REL1_19
UserrightsPage Class Reference

Special page to allow managing user group membership. More...

Inheritance diagram for UserrightsPage:
Collaboration diagram for UserrightsPage:

List of all members.

Public Member Functions

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

Protected Member Functions

 showEditUserGroupsForm ($user, $groups)
 Show the form to edit group memberships.
 showLogFragment ($user, $output)
 Show a rights log fragment for the specified user.
 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.

Static Protected Member Functions

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

Protected Attributes

 $isself = false
 $mTarget

Private Member Functions

 canAdd ($group)
 canRemove ($group)
 groupCheckboxes ($usergroups, $user)
 Adds a table with checkboxes where you can select what groups to add/remove.

Static Private Member Functions

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

Detailed Description

Special page to allow managing user group membership.

Definition at line 29 of file SpecialUserrights.php.


Constructor & Destructor Documentation

Definition at line 36 of file SpecialUserrights.php.


Member Function Documentation

UserrightsPage::addLogEntry ( user,
oldGroups,
newGroups,
reason 
)

Add a rights log entry for an action.

Definition at line 243 of file SpecialUserrights.php.

References $user, and makeGroupNameListForLog().

Referenced by doSaveUserGroups().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Format a link to a group description page.

Parameters:
$groupstring
Returns:
string

Definition at line 478 of file SpecialUserrights.php.

References User\getGroupName().

Referenced by showEditUserGroupsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

UserrightsPage::canAdd ( group) [private]
Parameters:
$groupstring: the name of the group to check
Returns:
bool Can we add the group?

Definition at line 584 of file SpecialUserrights.php.

References changeableGroups().

Referenced by groupCheckboxes().

Here is the call graph for this function:

Here is the caller graph for this function:

UserrightsPage::canRemove ( group) [private]
Parameters:
$groupString: the name of the group to check
Returns:
bool Can we remove the group?

Definition at line 573 of file SpecialUserrights.php.

References changeableGroups().

Referenced by groupCheckboxes().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns $this->getUser()->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 594 of file SpecialUserrights.php.

References SpecialPage\getUser().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Save user groups changes in the database.

Parameters:
$userUser object
$addArray of groups to add
$removeArray of groups to remove
$reasonString: reason for group change
Returns:
Array: Tuple of added, then removed groups

Definition at line 193 of file SpecialUserrights.php.

References $isself, $user, addLogEntry(), changeableGroups(), SpecialPage\getUser(), wfDebug(), and wfRunHooks().

Referenced by saveUserGroups().

Here is the call graph for this function:

Here is the caller graph for this function:

Edit user groups membership.

Parameters:
$usernameString: name of the user.

Definition at line 260 of file SpecialUserrights.php.

References $user, fetchUser(), SpecialPage\getOutput(), showEditUserGroupsForm(), and showLogFragment().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

Manage forms to be shown according to posted data.

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

Parameters:
$parMixed: string if any subpage provided, else null

Reimplemented from SpecialPage.

Definition at line 63 of file SpecialUserrights.php.

References $out, $user, changeableGroups(), SpecialPage\checkReadOnly(), editUserGroupsForm(), User\getCanonicalName(), SpecialPage\getOutput(), SpecialPage\getRequest(), getSuccessURL(), SpecialPage\getUser(), SpecialPage\outputHeader(), saveUserGroups(), SpecialPage\setHeaders(), switchForm(), and userCanChangeRights().

Here is the call graph for this function:

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:
Status object

Definition at line 285 of file SpecialUserrights.php.

References $user, $wgUserrightsInterwikiDelimiter, User\getCanonicalName(), SpecialPage\getUser(), Status\newFatal(), UserRightsProxy\newFromName(), User\newFromName(), Status\newGood(), UserRightsProxy\validDatabase(), wfWikiID(), UserRightsProxy\whoIs(), and User\whoIs().

Referenced by editUserGroupsForm(), ApiQueryUsers\execute(), ApiUserrights\getUrUser(), and saveUserGroups().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Referenced by groupCheckboxes(), and saveUserGroups().

Here is the caller graph for this function:

Definition at line 144 of file SpecialUserrights.php.

References SpecialPage\getTitle().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

UserrightsPage::groupCheckboxes ( usergroups,
user 
) [private]

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

Todo:
Just pass the username string?
Parameters:
$usergroupsArray: groups the user belongs to
$userUser a user object
Returns:
string XHTML table element with checkboxes

Definition at line 501 of file SpecialUserrights.php.

References $columns, $user, canAdd(), canRemove(), Xml\checkLabel(), Xml\closeElement(), Xml\element(), getAllGroups(), User\getGroupMember(), Xml\openElement(), Xml\tags(), and wfMessage().

Referenced by showEditUserGroupsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

Can be overridden by subclasses with more complicated permissions schemes.

Returns:
Boolean: should the page be displayed with the restricted-access pages?

Reimplemented from SpecialPage.

Definition at line 40 of file SpecialUserrights.php.

Definition at line 346 of file SpecialUserrights.php.

References wfMsgForContent().

Referenced by makeGroupNameListForLog().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 354 of file SpecialUserrights.php.

References makeGroupNameList().

Referenced by addLogEntry().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Save user groups changes in the database.

Data comes from the editUserGroupsForm() form function

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

Definition at line 156 of file SpecialUserrights.php.

References $user, doSaveUserGroups(), fetchUser(), getAllGroups(), SpecialPage\getOutput(), and SpecialPage\getRequest().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Show a rights log fragment for the specified user.

Parameters:
$userUser to show log for
$outputOutputPage to use

Definition at line 604 of file SpecialUserrights.php.

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

Referenced by editUserGroupsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

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:
$groupsArray: list of groups the given user is in
Returns:
Array: Tuple of addable, then removable groups

Definition at line 386 of file SpecialUserrights.php.

References changeableGroups().

Here is the call graph for this function:

Output a form to allow searching for a user.

Definition at line 365 of file SpecialUserrights.php.

References $wgScript, Html\closeElement(), Xml\fieldset(), SpecialPage\getOutput(), SpecialPage\getTitle(), Html\hidden(), Xml\inputLabel(), Html\openElement(), Xml\submitButton(), and wfMsg().

Referenced by execute().

Here is the call graph for this function:

Here is the caller graph for this function:

UserrightsPage::userCanChangeRights ( user,
checkIfSelf = true 
)

Definition at line 48 of file SpecialUserrights.php.

References changeableGroups().

Referenced by execute(), and userCanExecute().

Here is the call graph for this function:

Here is the caller graph for this function:

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:
$userUser: the user to check
Returns:
Boolean: does the user have permission to view the page?

Reimplemented from SpecialPage.

Definition at line 44 of file SpecialUserrights.php.

References userCanChangeRights().

Here is the call graph for this function:


Member Data Documentation

UserrightsPage::$isself = false [protected]

Definition at line 34 of file SpecialUserrights.php.

Referenced by doSaveUserGroups().

UserrightsPage::$mTarget [protected]

Definition at line 33 of file SpecialUserrights.php.


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