BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
UserrightsPage Class Reference
Inheritance diagram for UserrightsPage:
Collaboration diagram for UserrightsPage:

Public Member Functions

 doesWrites ()
 
 userCanChangeRights ($targetUser, $checkIfSelf=true)
 
 execute ($par)
 
 getSuccessURL ()
 
 canProcessExpiries ()
 
 doSaveUserGroups ($user, array $add, array $remove, $reason= '', array $tags=[], array $groupExpiries=[])
 
 editUserGroupsForm ($username)
 
 fetchUser ($username, $writing=true)
 
 makeGroupNameList ($ids)
 
 switchForm ()
 
 changeableGroups ()
 
 prefixSearchSubpages ($search, $limit, $offset)
 
- Public Member Functions inherited from SpecialPage
 __construct ($name= '', $restriction= '', $listed=true, $function=false, $file= '', $includable=false)
 
 getName ()
 
 getRestriction ()
 
 isListed ()
 
 setListed ($listed)
 
 listed ($x=null)
 
 isIncludable ()
 
 maxIncludeCacheTime ()
 
 including ($x=null)
 
 getLocalName ()
 
 isExpensive ()
 
 isCached ()
 
 isRestricted ()
 
 userCanExecute (User $user)
 
 displayRestrictionError ()
 
 checkPermissions ()
 
 checkReadOnly ()
 
 requireLogin ($reasonMsg= 'exception-nologin-text', $titleMsg= 'exception-nologin')
 
 prefixSearchSubpages ($search, $limit, $offset)
 
 setHeaders ()
 
 run ($subPage)
 
 execute ($subPage)
 
 outputHeader ($summaryMessageKey= '')
 
 getDescription ()
 
 getTitle ($subpage=false)
 
 getPageTitle ($subpage=false)
 
 setContext ($context)
 
 getContext ()
 
 getRequest ()
 
 getOutput ()
 
 getUser ()
 
 getSkin ()
 
 getLanguage ()
 
 getConfig ()
 
 getFullTitle ()
 
 msg ($key)
 
 addHelpLink ($to, $overrideBaseUrl=false)
 
 getFinalGroupName ()
 
 doesWrites ()
 
 getLinkRenderer ()
 
 setLinkRenderer (LinkRenderer $linkRenderer)
 

Static Public Member Functions

static expiryToTimestamp ($expiry)
 
- Static Public Member Functions inherited from SpecialPage
static getTitleFor ($name, $subpage=false, $fragment= '')
 
static getTitleValueFor ($name, $subpage=false, $fragment= '')
 
static getSafeTitleFor ($name, $subpage=false)
 

Protected Member Functions

 saveUserGroups ($username, $reason, $user)
 
 addLogEntry ($user, array $oldGroups, array $newGroups, $reason, array $tags, array $oldUGMs, array $newUGMs)
 
 showEditUserGroupsForm ($user, $groups, $groupMemberships)
 
 showLogFragment ($user, $output)
 
 getGroupName ()
 
- Protected Member Functions inherited from SpecialPage
 getCacheTTL ()
 
 getLoginSecurityLevel ()
 
 checkLoginSecurityLevel ($level=null)
 
 getSubpagesForPrefixSearch ()
 
 prefixSearchString ($search, $limit, $offset)
 
 beforeExecute ($subPage)
 
 afterExecute ($subPage)
 
 getRobotPolicy ()
 
 addFeedLinks ($params)
 
 getGroupName ()
 
 useTransactionalTimeLimit ()
 

Static Protected Member Functions

static serialiseUgmForLog ($ugm)
 
static getAllGroups ()
 
- Static Protected Member Functions inherited from SpecialPage
static prefixSearchArray ($search, $limit, array $subpages, $offset)
 

Protected Attributes

 $mTarget
 
 $mFetchedUser = null
 
 $isself = false
 
- Protected Attributes inherited from SpecialPage
 $mName
 
 $mRestriction
 
 $mIncluding
 
 $mIncludable
 
 $mContext
 

Detailed Description

Special page to allow managing user group membership

Member Function Documentation

UserrightsPage::addLogEntry (   $user,
array  $oldGroups,
array  $newGroups,
  $reason,
array  $tags,
array  $oldUGMs,
array  $newUGMs 
)
protected

Add a rights log entry for an action.

Parameters
User | UserRightsProxy$user
array$oldGroups
array$newGroups
string$reason
array$tagsChange tags for the log entry
array$oldUGMsAssociative array of (group name => UserGroupMembership)
array$newUGMsAssociative array of (group name => UserGroupMembership)
UserrightsPage::canProcessExpiries ( )

Returns true if this user rights form can set and change user group expiries. Subclasses may wish to override this to return false.

Returns
bool
UserrightsPage::changeableGroups ( )

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 ) )
UserrightsPage::doSaveUserGroups (   $user,
array  $add,
array  $remove,
  $reason = '',
array  $tags = [],
array  $groupExpiries = [] 
)

Save user groups changes in the database. This function does not throw errors; instead, it ignores groups that the performer does not have permission to set.

Parameters
User | UserRightsProxy$user
array$addArray of groups to add
array$removeArray of groups to remove
string$reasonReason for group change
array$tagsArray of change tags to add to the log entry
array$groupExpiriesAssociative array of (group name => expiry), containing only those groups that are to have new expiry values set
Returns
array Tuple of added, then removed groups
UserrightsPage::editUserGroupsForm (   $username)

Edit user groups membership

Parameters
string$usernameName of the user.
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
string | null$parString if any subpage provided, else null
Exceptions
UserBlockedError|PermissionsError
static UserrightsPage::expiryToTimestamp (   $expiry)
static

Converts a user group membership expiry string into a timestamp. Words like 'existing' or 'other' should have been filtered out before calling this function.

Parameters
string$expiry
Returns
string|null|false A string containing a valid timestamp, or null if the expiry is infinite, or false if the timestamp is not valid
UserrightsPage::fetchUser (   $username,
  $writing = true 
)

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

Parameters
string$username
bool$writing
Returns
Status
static UserrightsPage::getAllGroups ( )
staticprotected

Returns an array of all groups that may be edited

Returns
array Array of groups that may be edited.
UserrightsPage::makeGroupNameList (   $ids)
Since
1.15
Parameters
array$ids
Returns
string
UserrightsPage::prefixSearchSubpages (   $search,
  $limit,
  $offset 
)

Return an array of subpages beginning with $search that this special page will accept.

Parameters
string$searchPrefix to search for
int$limitMaximum number of results to return (usually 10)
int$offsetNumber of results to skip (usually 0)
Returns
string[] Matching subpages
UserrightsPage::saveUserGroups (   $username,
  $reason,
  $user 
)
protected

Save user groups changes in the database. Data comes from the editUserGroupsForm() form function

Parameters
string$usernameUsername to apply changes to.
string$reasonReason for group change
User | UserRightsProxy$userTarget user object.
Returns
Status
static UserrightsPage::serialiseUgmForLog (   $ugm)
staticprotected

Serialise a UserGroupMembership object for storage in the log_params section of the logging table. Only keeps essential data, removing redundant fields.

Parameters
UserGroupMembership | null$ugmMay be null if things get borked
Returns
array
UserrightsPage::showEditUserGroupsForm (   $user,
  $groups,
  $groupMemberships 
)
protected

Show the form to edit group memberships.

Parameters
User | UserRightsProxy$userUser or UserRightsProxy you're editing
array$groupsArray of groups the user is in. Not used by this implementation anymore, but kept for backward compatibility with subclasses
array$groupMembershipsAssociative array of (group name => UserGroupMembership object) containing the groups the user is in
UserrightsPage::showLogFragment (   $user,
  $output 
)
protected

Show a rights log fragment for the specified user

Parameters
User$userUser to show log for
OutputPage$outputOutputPage to use
UserrightsPage::switchForm ( )

Output a form to allow searching for a user

UserrightsPage::userCanChangeRights (   $targetUser,
  $checkIfSelf = true 
)

Check whether the current user (from context) can change the target user's rights.

Parameters
User$targetUserUser whose rights are being changed
bool$checkIfSelfIf false, assume that the current user can add/remove groups defined in $wgGroupsAddToSelf / $wgGroupsRemoveFromSelf, without checking if it's the same as target user
Returns
bool

Member Data Documentation

null string UserrightsPage::$mTarget
protected

The target of the local right-adjuster's interest. Can be gotten from either a GET parameter or a subpage-style parameter, so have a member variable for it.


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