TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
BackendUserAuthentication Class Reference
Inheritance diagram for BackendUserAuthentication:
AbstractUserAuthentication FrontendBackendUserAuthentication

Public Member Functions

 __construct ()
 
 isAdmin ()
 
 isMemberOfGroup ($groupId)
 
 doesUserHaveAccess ($row, $perms)
 
 isInWebMount ($id, $readPerms= '', $exitOnError=0)
 
 modAccess ($conf, $exitOnError)
 
 getPagePermsClause ($perms)
 
 calcPerms ($row)
 
 isRTE ()
 
 check ($type, $value)
 
 checkAuthMode ($table, $field, $value, $authMode)
 
 checkLanguageAccess ($langValue)
 
 checkFullLanguagesAccess ($table, $record)
 
 recordEditAccessInternals ($table, $idOrRow, $newRecord=false, $deletedRecord=false, $checkFullLanguageAccess=false)
 
 isPSet ($compiledPermissions, $tableName, $actionType= '')
 
 mayMakeShortcut ()
 
 workspaceCannotEditRecord ($table, $recData)
 
 workspaceCannotEditOfflineVersion ($table, $recData)
 
 workspaceAllowLiveRecordsInPID ($pid, $table)
 
 workspaceCreateNewRecord ($pid, $table)
 
 workspaceAllowAutoCreation ($table, $id, $recpid)
 
 workspaceCheckStageForCurrent ($stage)
 
 workspacePublishAccess ($wsid)
 
 workspaceSwapAccess ()
 
 getTSConfig ($objectString, $config= '')
 
 getTSConfigVal ($objectString)
 
 getTSConfigProp ($objectString)
 
 returnWebmounts ()
 
 setWebmounts (array $mountPointUids, $append=false)
 
 jsConfirmation ($bitmask)
 
 fetchGroupData ()
 
 fetchGroups ($grList, $idList= '')
 
 setCachedList ($cList)
 
 getCategoryMountPoints ()
 
 getFileMountRecords ()
 
 getFileStorages ()
 
 evaluateUserSpecificFileFilterSettings ()
 
 getFilePermissions ()
 
 getFilePermissionsForStorage (\TYPO3\CMS\Core\Resource\ResourceStorage $storageObject)
 
 getDefaultUploadTemporaryFolder ()
 
 addTScomment ($str)
 
 workspaceInit ()
 
 checkWorkspace ($wsRec, $fields= 'uid, title, adminusers, members, reviewers, publish_access, stagechg_notification')
 
 checkWorkspaceCurrent ()
 
 setWorkspace ($workspaceId)
 
 setTemporaryWorkspace ($workspaceId)
 
 setDefaultWorkspace ()
 
 setWorkspacePreview ($previewState)
 
 getDefaultWorkspace ()
 
 writelog ($type, $action, $error, $details_nr, $details, $data, $tablename= '', $recuid= '', $recpid= '', $event_pid=-1, $NEWid= '', $userId=0)
 
 simplelog ($message, $extKey= '', $error=0)
 
 checkLockToIP ()
 
 backendCheckLogin ($proceedIfNoUserIsLoggedIn=false)
 
 backendSetUC ()
 
 overrideUC ()
 
 resetUC ()
 
 logoff ()
 
- Public Member Functions inherited from AbstractUserAuthentication
 __construct ()
 
 start ()
 
 isSetSessionCookie ()
 
 isRefreshTimeBasedCookie ()
 
 checkAuthentication ()
 
 createSessionId ()
 
 createUserSession ($tempuser)
 
 getNewSessionRecord ($tempuser)
 
 fetchUserSession ($skipSessionUpdate=false)
 
 logoff ()
 
 removeCookie ($cookieName)
 
 isExistingSessionRecord ($id)
 
 isCookieSet ()
 
 veriCode ()
 
 writeUC ($variable= '')
 
 unpack_uc ($theUC= '')
 
 pushModuleData ($module, $data, $noSave=0)
 
 getModuleData ($module, $type= '')
 
 getSessionData ($key)
 
 setAndSaveSessionData ($key, $data)
 
 getLoginFormData ()
 
 processLoginData ($loginData, $passwordTransmissionStrategy= '')
 
 getAuthInfoArray ()
 
 compareUident ($user, $loginData, $passwordCompareStrategy= '')
 
 gc ()
 
 writelog ($type, $action, $error, $details_nr, $details, $data, $tablename, $recuid, $recpid)
 
 checkLogFailures ($email, $secondsBack, $maxFailures)
 
 setBeUserByUid ($uid)
 
 setBeUserByName ($name)
 
 getRawUserByUid ($uid)
 
 getRawUserByName ($name)
 
 fetchUserRecord ($dbUser, $username, $extraWhere= '')
 

Static Public Member Functions

static getCookieName ()
 

Public Attributes

 $usergroup_column = 'usergroup'
 
 $usergroup_table = 'be_groups'
 
 $groupData
 
 $userGroups = []
 
 $userGroupsUID = []
 
 $groupList = ''
 
 $workspace = -99
 
 $workspaceRec = []
 
 $dataLists
 
 $includeGroupArray = []
 
 $TSdataArray = []
 
 $userTS_text = ''
 
 $userTS = []
 
 $userTSUpdated = false
 
 $userTS_dontGetCached = false
 
 $errorMsg = ''
 
 $checkWorkspaceCurrent_cache = null
 
 $session_table = 'be_sessions'
 
 $user_table = 'be_users'
 
 $username_column = 'username'
 
 $userident_column = 'password'
 
 $userid_column = 'uid'
 
 $lastLogin_column = 'lastlogin'
 
 $enablecolumns
 
 $formfield_uname = 'username'
 
 $formfield_uident = 'userident'
 
 $formfield_status = 'login_status'
 
 $writeStdLog = true
 
 $writeAttemptLog = true
 
 $sessionTimeout = 6000
 
 $firstMainGroup = 0
 
 $uc
 
 $uc_default
 
- Public Attributes inherited from AbstractUserAuthentication
 $session_table = ''
 
 $name = ''
 
 $get_name = ''
 
 $user_table = ''
 
 $usergroup_table = ''
 
 $username_column = ''
 
 $userident_column = ''
 
 $userid_column = ''
 
 $usergroup_column = ''
 
 $lastLogin_column = ''
 
 $enablecolumns
 
 $showHiddenRecords = false
 
 $formfield_uname = ''
 
 $formfield_uident = ''
 
 $formfield_status = ''
 
 $sessionTimeout = 0
 
 $auth_timeout_field = ''
 
 $lifetime = 0
 
 $gc_time = 0
 
 $gc_probability = 1
 
 $writeStdLog = false
 
 $writeAttemptLog = false
 
 $sendNoCacheHeaders = true
 
 $getFallBack = false
 
 $hash_length = 32
 
 $getMethodEnabled = false
 
 $lockIP = 4
 
 $lockHashKeyWords = 'useragent'
 
 $warningEmail = ''
 
 $warningPeriod = 3600
 
 $warningMax = 3
 
 $checkPid = true
 
 $checkPid_value = 0
 
 $id
 
 $loginFailure = false
 
 $loginSessionStarted = false
 
 $user = null
 
 $get_URL_ID = ''
 
 $newSessionID = false
 
 $forceSetCookie = false
 
 $dontSetCookie = false
 
 $loginType = ''
 
 $svConfig = []
 
 $writeDevLog = false
 
 $uc
 

Protected Member Functions

 initializeDbMountpointsInWorkspace ()
 
 isUserAllowedToLogin ()
 
- Protected Member Functions inherited from AbstractUserAuthentication
 setSessionCookie ()
 
 getCookieDomain ()
 
 getCookie ($cookieName)
 
 regenerateSessionId ()
 
 fetchUserSessionFromDB ()
 
 userConstraints ()
 
 user_where_clause ()
 
 ipLockClause ()
 
 ipLockClause_remoteIPNumber ($parts)
 
 hashLockClause ()
 
 hashLockClause_getHashInt ()
 

Protected Attributes

 $fileStorages
 
 $filePermissions
 
- Protected Attributes inherited from AbstractUserAuthentication
 $cookieWasSetOnCurrentRequest = false
 

Detailed Description

TYPO3 backend user authentication Contains most of the functions used for checking permissions, authenticating users, setting up the user, and API for user from outside. This class contains the configuration of the database fields used plus some functions for the authentication process of backend users.

Definition at line 38 of file BackendUserAuthentication.php.

Constructor & Destructor Documentation

__construct ( )

Constructor

Definition at line 301 of file BackendUserAuthentication.php.

References $GLOBALS.

Member Function Documentation

addTScomment (   $str)

Creates a TypoScript comment with the string text inside.

Parameters
string$strThe text to wrap in comment prefixes and delimiters.
Returns
string TypoScript comment with the string text inside.

Definition at line 2010 of file BackendUserAuthentication.php.

References GeneralUtility\trimExplode().

Referenced by BackendUserAuthentication\fetchGroupData(), and BackendUserAuthentication\fetchGroups().

backendCheckLogin (   $proceedIfNoUserIsLoggedIn = false)

Check if user is logged in and if so, call ->fetchGroupData() to load group information and access lists of all kind, further check IP, set the ->uc array and send login-notification email if required. If no user is logged in the default behaviour is to exit with an error message. This function is called right after ->start() in fx. the TYPO3 Bootstrap.

Parameters
bool$proceedIfNoUserIsLoggedInif this option is set, then there won't be a redirect to the login screen of the Backend - used for areas in the backend which do not need user rights like the login page.
Exceptions
RuntimeException
Returns
void

Definition at line 2504 of file BackendUserAuthentication.php.

References BackendUserAuthentication\backendSetUC(), BackendUserAuthentication\checkLockToIP(), BackendUserAuthentication\fetchGroupData(), GeneralUtility\getIndpEnv(), BackendUserAuthentication\isUserAllowedToLogin(), and HttpUtility\redirect().

backendSetUC ( )

Initialize the internal ->uc array for the backend user Will make the overrides if necessary, and write the UC back to the be_users record if changes has happened

Returns
void

Definition at line 2538 of file BackendUserAuthentication.php.

References $GLOBALS, BackendUserAuthentication\$uc, BackendUserAuthentication\getTSConfigProp(), BackendUserAuthentication\overrideUC(), GeneralUtility\removeDotsFromTS(), AbstractUserAuthentication\unpack_uc(), and AbstractUserAuthentication\writeUC().

Referenced by BackendUserAuthentication\backendCheckLogin(), and BackendUserAuthentication\resetUC().

calcPerms (   $row)

Returns a combined binary representation of the current users permissions for the page-record, $row. The perms for user, group and everybody is OR'ed together (provided that the page-owner is the user and for the groups that the user is a member of the group. If the user is admin, 31 is returned (full permissions for all five flags)

Parameters
array$rowInput page row with all perms_* fields available.
Returns
int Bitwise representation of the users permissions in relation to input page row, $row

Definition at line 540 of file BackendUserAuthentication.php.

References $GLOBALS, Permission\ALL, GeneralUtility\callUserFunction(), BackendUserAuthentication\isAdmin(), BackendUserAuthentication\isInWebMount(), BackendUserAuthentication\isMemberOfGroup(), and Permission\NOTHING.

Referenced by BackendUserAuthentication\doesUserHaveAccess().

check (   $type,
  $value 
)

Returns TRUE if the $value is found in the list in a $this->groupData[] index pointed to by $type (array key). Can thus be users to check for modules, exclude-fields, select/modify permissions for tables etc. If user is admin TRUE is also returned Please see the document Inside TYPO3 for examples.

Parameters
string$typeThe type value; "webmounts", "filemounts", "pagetypes_select", "tables_select", "tables_modify", "non_exclude_fields", "modules
string$valueString to search for in the groupData-list
Returns
bool TRUE if permission is granted (that is, the value was found in the groupData list - or the BE_USER is "admin")

Definition at line 598 of file BackendUserAuthentication.php.

References GeneralUtility\inList(), and BackendUserAuthentication\isAdmin().

Referenced by BackendUserAuthentication\checkLanguageAccess(), and BackendUserAuthentication\modAccess().

checkAuthMode (   $table,
  $field,
  $value,
  $authMode 
)

Checking the authMode of a select field with authMode set

Parameters
string$tableTable name
string$fieldField name (must be configured in TCA and of type "select" with authMode set!)
string$valueValue to evaluation (single value, must not contain any of the chars ":,|")
string$authModeAuth mode keyword (explicitAllow, explicitDeny, individual)
Returns
bool Whether access is granted or not

Definition at line 617 of file BackendUserAuthentication.php.

References $GLOBALS, GeneralUtility\inList(), and BackendUserAuthentication\isAdmin().

Referenced by BackendUserAuthentication\recordEditAccessInternals().

checkFullLanguagesAccess (   $table,
  $record 
)

Check if user has access to all existing localizations for a certain record

Parameters
string$tableThe table
array$recordThe current record
Returns
bool

Definition at line 700 of file BackendUserAuthentication.php.

References $GLOBALS, BackendUserAuthentication\checkLanguageAccess(), BackendUtility\getRecordsByField(), and BackendUtility\isTableLocalizable().

Referenced by BackendUserAuthentication\recordEditAccessInternals().

checkLanguageAccess (   $langValue)

Checking if a language value (-1, 0 and >0 for sys_language records) is allowed to be edited by the user.

Parameters
int$langValueLanguage value to evaluate
Returns
bool Returns TRUE if the language value is allowed, otherwise FALSE.

Definition at line 680 of file BackendUserAuthentication.php.

References BackendUserAuthentication\check().

Referenced by BackendUserAuthentication\checkFullLanguagesAccess(), and BackendUserAuthentication\recordEditAccessInternals().

checkLockToIP ( )

If TYPO3_CONF_VARS['BE']['enabledBeUserIPLock'] is enabled and an IP-list is found in the User TSconfig objString "options.lockToIP", then make an IP comparison with REMOTE_ADDR and return the outcome (TRUE/FALSE)

Returns
bool TRUE, if IP address validates OK (or no check is done at all)

Definition at line 2481 of file BackendUserAuthentication.php.

References $GLOBALS, GeneralUtility\cmpIP(), GeneralUtility\getIndpEnv(), and BackendUserAuthentication\getTSConfigVal().

Referenced by BackendUserAuthentication\backendCheckLogin().

checkWorkspace (   $wsRec,
  $fields = 'uid,
title  ,
adminusers  ,
members  ,
reviewers  ,
publish_access  ,
stagechg_notification'   
)

Checking if a workspace is allowed for backend user

Parameters
mixed$wsRecIf integer, workspace record is looked up, if array it is seen as a Workspace record with at least uid, title, members and adminusers columns. Can be faked for workspaces uid 0 and -1 (online and offline)
string$fieldsList of fields to select. Default fields are: uid,title,adminusers,members,reviewers,publish_access,stagechg_notification
Returns
array Output will also show how access was granted. Admin users will have a true output regardless of input.

Definition at line 2078 of file BackendUserAuthentication.php.

References $fields, GeneralUtility\inList(), BackendUserAuthentication\isAdmin(), GeneralUtility\makeInstance(), Permission\PAGE_SHOW, and GeneralUtility\trimExplode().

Referenced by BackendUserAuthentication\checkWorkspaceCurrent(), BackendUserAuthentication\getDefaultWorkspace(), BackendUserAuthentication\setDefaultWorkspace(), BackendUserAuthentication\setTemporaryWorkspace(), and BackendUserAuthentication\workspacePublishAccess().

checkWorkspaceCurrent ( )

Uses checkWorkspace() to check if current workspace is available for user. This function caches the result and so can be called many times with no performance loss.

Returns
array See checkWorkspace()
See also
checkWorkspace()

Definition at line 2159 of file BackendUserAuthentication.php.

References BackendUserAuthentication\$checkWorkspaceCurrent_cache, and BackendUserAuthentication\checkWorkspace().

Referenced by BackendUserAuthentication\workspaceCheckStageForCurrent().

doesUserHaveAccess (   $row,
  $perms 
)

Checks if the permissions is granted based on a page-record ($row) and $perms (binary and'ed)

Bits for permissions, see $perms variable:

1 - Show: See/Copy page and the pagecontent. 16- Edit pagecontent: Change/Add/Delete/Move pagecontent. 2- Edit page: Change/Move the page, eg. change title, startdate, hidden. 4- Delete page: Delete the page and pagecontent. 8- New pages: Create new pages under the page.

Parameters
array$rowIs the pagerow for which the permissions is checked
int$permsIs the binary representation of the permission we are going to check. Every bit in this number represents a permission that must be set. See function explanation.
Returns
bool

Definition at line 357 of file BackendUserAuthentication.php.

References BackendUserAuthentication\calcPerms().

Referenced by FrontendBackendUserAuthentication\extPageReadAccess().

evaluateUserSpecificFileFilterSettings ( )

Adds filters based on what the user has set this should be done in this place, and called whenever needed, but only when needed

Returns
void

Definition at line 1780 of file BackendUserAuthentication.php.

References FileNameFilter\setShowHiddenFilesAndFolders().

fetchGroupData ( )
fetchGroups (   $grList,
  $idList = '' 
)

Fetches the group records, subgroups and fills internal arrays. Function is called recursively to fetch subgroups

Parameters
string$grListCommalist of be_groups uid numbers
string$idListList of already processed be_groups-uids so the function will not fall into an eternal recursion.
Returns
void private

Definition at line 1427 of file BackendUserAuthentication.php.

References $GLOBALS, BackendUserAuthentication\addTScomment(), GeneralUtility\callUserFunction(), GeneralUtility\getIndpEnv(), GeneralUtility\getUserObj(), GeneralUtility\inList(), GeneralUtility\intExplode(), GeneralUtility\makeInstance(), Permission\PAGE_EDIT, and Permission\PAGE_SHOW.

Referenced by BackendUserAuthentication\fetchGroupData().

getCategoryMountPoints ( )

Returns an array of category mount points. The category permissions from BE Groups are also taken into consideration and are merged into User permissions.

Returns
array

Definition at line 1584 of file BackendUserAuthentication.php.

References GeneralUtility\trimExplode().

static getCookieName ( )
static

Getter for the cookie name

Returns
string returns the configured cookie name

Definition at line 2465 of file BackendUserAuthentication.php.

References $GLOBALS.

Referenced by LoginController\checkRedirect(), BackendUserSessionRepository\switchBackToOriginalUser(), and BackendUserController\switchUser().

getDefaultUploadTemporaryFolder ( )

Returns a object that could be used for uploading temporary files in user context. The folder temp below the default upload folder of the user is used.

Returns
NULL|
See also
::getDefaultUploadFolder();

Definition at line 1983 of file BackendUserAuthentication.php.

getDefaultWorkspace ( )

Return default workspace ID for user, If EXT:workspaces is not installed the user will be pushed the the Live workspace

Returns
int Default workspace id. If no workspace is available it will be "-99

Definition at line 2247 of file BackendUserAuthentication.php.

References BackendUserAuthentication\checkWorkspace(), and GeneralUtility\makeInstance().

Referenced by BackendUserAuthentication\setDefaultWorkspace().

getFileMountRecords ( )

Returns an array of file mount records, taking workspaces and user home and group home directories into account Needs to be called AFTER the groups have been loaded.

Returns
array

Definition at line 1617 of file BackendUserAuthentication.php.

References $GLOBALS, BackendUserAuthentication\$groupData, BackendUserAuthentication\getTSConfigVal(), GeneralUtility\intExplode(), GeneralUtility\makeInstance(), Permission\PAGE_EDIT, QueryHelper\parseOrderBy(), and GeneralUtility\trimExplode().

getFilePermissions ( )

Returns the information about file permissions. Previously, this was stored in the DB field fileoper_perms now it is file_permissions. Besides it can be handled via userTSconfig

permissions.file.default { addFile = 1 readFile = 1 writeFile = 1 copyFile = 1 moveFile = 1 renameFile = 1 deleteFile = 1

addFolder = 1 readFolder = 1 writeFolder = 1 copyFolder = 1 moveFolder = 1 renameFolder = 1 deleteFolder = 1 recursivedeleteFolder = 1 }

overwrite settings for a specific storageObject

permissions.file.storage.StorageUid { readFile = 1 recursivedeleteFolder = 0 }

Please note that these permissions only apply, if the storage has the capabilities (browseable, writable), and if the driver allows for writing etc

Returns
array

Definition at line 1824 of file BackendUserAuthentication.php.

References BackendUserAuthentication\$filePermissions, BackendUserAuthentication\getTSConfigProp(), BackendUserAuthentication\isAdmin(), and GeneralUtility\trimExplode().

Referenced by BackendUserAuthentication\getFilePermissionsForStorage().

getFilePermissionsForStorage ( \TYPO3\CMS\Core\Resource\ResourceStorage  $storageObject)

Gets the file permissions for a storage by merging any storage-specific permissions for a storage with the default settings. Admin users will always get the default settings.

Parameters
\TYPO3\CMS\Core\Resource\ResourceStorage$storageObject
Returns
array

Definition at line 1883 of file BackendUserAuthentication.php.

References BackendUserAuthentication\getFilePermissions(), BackendUserAuthentication\getTSConfigProp(), and BackendUserAuthentication\isAdmin().

getFileStorages ( )

Returns an array with the filemounts for the user. Each filemount is represented with an array of a "name", "path" and "type". If no filemounts an empty array is returned.

Returns
[]

Definition at line 1764 of file BackendUserAuthentication.php.

References BackendUserAuthentication\$fileStorages.

getPagePermsClause (   $perms)

Returns a WHERE-clause for the pages-table where user permissions according to input argument, $perms, is validated. $perms is the "mask" used to select. Fx. if $perms is 1 then you'll get all pages that a user can actually see! 2^0 = show (1) 2^1 = edit (2) 2^2 = delete (4) 2^3 = new (8) If the user is 'admin' " 1=1" is returned (no effect) If the user is not set at all (->user is not an array), then " 1=0" is returned (will cause no selection results at all) The 95% use of this function is "->getPagePermsClause(1)" which will return WHERE clauses for selecting pages in backend listings - in other words this will check read permissions.

Parameters
int$permsPermission mask to use, see function description
Returns
string Part of where clause. Prefix " AND " to this.

Definition at line 468 of file BackendUserAuthentication.php.

References $GLOBALS, GeneralUtility\callUserFunction(), ExpressionBuilder\EQ, GeneralUtility\intExplode(), BackendUserAuthentication\isAdmin(), and GeneralUtility\makeInstance().

Referenced by BackendUserAuthentication\fetchGroupData(), and BackendUserAuthentication\isInWebMount().

getTSConfig (   $objectString,
  $config = '' 
)

Returns the value/properties of a TS-object as given by $objectString, eg. 'options.dontMountAdminMounts' Nice (general!) function for returning a part of a TypoScript array!

Parameters
string$objectStringPointer to an "object" in the TypoScript array, fx. 'options.dontMountAdminMounts'
array | string$configOptional TSconfig array: If array, then this is used and not $this->userTS. If not array, $this->userTS is used.
Returns
array An array with two keys, "value" and "properties" where "value" is a string with the value of the object string and "properties" is an array with the properties of the object string.

Definition at line 1172 of file BackendUserAuthentication.php.

References BackendUserAuthentication\$userTS, and GeneralUtility\trimExplode().

Referenced by BackendUserAuthentication\getTSConfigProp(), BackendUserAuthentication\getTSConfigVal(), and BackendUserAuthentication\jsConfirmation().

getTSConfigProp (   $objectString)

Returns the "properties" of the $objectString from the BE_USERS "User TSconfig" array

Parameters
string$objectStringObject string, eg. "somestring.someproperty.somesubproperty
Returns
array The properties for that object string (object path) - if any
See also
getTSConfig()

Definition at line 1215 of file BackendUserAuthentication.php.

References BackendUserAuthentication\getTSConfig().

Referenced by BackendUserAuthentication\backendSetUC(), BackendUserAuthentication\getFilePermissions(), BackendUserAuthentication\getFilePermissionsForStorage(), FrontendBackendUserAuthentication\initializeAdminPanel(), and BackendUserAuthentication\overrideUC().

getTSConfigVal (   $objectString)

Returns the "value" of the $objectString from the BE_USERS "User TSconfig" array

Parameters
string$objectStringObject string, eg. "somestring.someproperty.somesubproperty
Returns
string The value for that object string (object path)
See also
getTSConfig()

Definition at line 1202 of file BackendUserAuthentication.php.

References BackendUserAuthentication\getTSConfig().

Referenced by BackendUserAuthentication\checkLockToIP(), BackendUserAuthentication\fetchGroupData(), BackendUserAuthentication\getFileMountRecords(), BackendUserAuthentication\mayMakeShortcut(), and BackendUserAuthentication\workspaceInit().

initializeDbMountpointsInWorkspace ( )
protected

Limiting the DB mountpoints if there any selected in the workspace record

Returns
void

Definition at line 2046 of file BackendUserAuthentication.php.

References GeneralUtility\intExplode(), and BackendUserAuthentication\isInWebMount().

Referenced by BackendUserAuthentication\workspaceInit().

isInWebMount (   $id,
  $readPerms = '',
  $exitOnError = 0 
)

Checks if the page id, $id, is found within the webmounts set up for the user. This should ALWAYS be checked for any page id a user works with, whether it's about reading, writing or whatever. The point is that this will add the security that a user can NEVER touch parts outside his mounted pages in the page tree. This is otherwise possible if the raw page permissions allows for it. So this security check just makes it easier to make safe user configurations. If the user is admin OR if this feature is disabled (fx. by setting TYPO3_CONF_VARS['BE']['lockBeUserToDBmounts']=0) then it returns "1" right away Otherwise the function will return the uid of the webmount which was first found in the rootline of the input page $id

Parameters
int$idPage ID to check
string$readPermsContent of "->getPagePermsClause(1)" (read-permissions). If not set, they will be internally calculated (but if you have the correct value right away you can save that database lookup!)
bool | int$exitOnErrorIf set, then the function will exit with an error message.
Exceptions
RuntimeException
Returns
int|NULL The page UID of a page in the rootline that matched a mount point

Definition at line 379 of file BackendUserAuthentication.php.

References $GLOBALS, AbstractUserAuthentication\$id, BackendUtility\BEgetRootLine(), BackendUserAuthentication\getPagePermsClause(), BackendUtility\getRecord(), BackendUserAuthentication\isAdmin(), and BackendUserAuthentication\returnWebmounts().

Referenced by BackendUserAuthentication\calcPerms(), FrontendBackendUserAuthentication\extPageReadAccess(), and BackendUserAuthentication\initializeDbMountpointsInWorkspace().

isMemberOfGroup (   $groupId)

Returns TRUE if the current user is a member of group $groupId $groupId must be set. $this->groupList must contain groups Will return TRUE also if the user is a member of a group through subgroups.

Parameters
int$groupIdGroup ID to look for in $this->groupList
Returns
bool

Definition at line 333 of file BackendUserAuthentication.php.

References GeneralUtility\inList().

Referenced by BackendUserAuthentication\calcPerms().

isPSet (   $compiledPermissions,
  $tableName,
  $actionType = '' 
)

Checks a type of permission against the compiled permission integer, $compiledPermissions, and in relation to table, $tableName

Parameters
int$compiledPermissionsCould typically be the "compiled permissions" integer returned by ->calcPerms
string$tableNameIs the tablename to check: If "pages" table then edit,new,delete and editcontent permissions can be checked. Other tables will be checked for "editcontent" only (and $type will be ignored)
string$actionTypeFor $tableName='pages' this can be 'edit' (2), 'new' (8 or 16), 'delete' (4), 'editcontent' (16). For all other tables this is ignored. (16 is used)
Returns
bool public (used by ClickMenuController)

Definition at line 848 of file BackendUserAuthentication.php.

References Permission\CONTENT_EDIT, BackendUserAuthentication\isAdmin(), Permission\PAGE_DELETE, Permission\PAGE_EDIT, and Permission\PAGE_NEW.

isRTE ( )

Returns TRUE if the RTE (Rich Text Editor) is enabled for the user.

Returns
bool

Definition at line 583 of file BackendUserAuthentication.php.

isUserAllowedToLogin ( )
protected

Determines whether a backend user is allowed to access the backend.

The conditions are:

  • backend user is a regular user and adminOnly is not defined
  • backend user is an admin user
  • backend user is used in CLI context and adminOnly is explicitly set to "2"
  • backend user is being controlled by an admin user
Returns
bool Whether a backend user is allowed to access the backend

Definition at line 2672 of file BackendUserAuthentication.php.

References BackendUserAuthentication\isAdmin(), and GeneralUtility\makeInstance().

Referenced by BackendUserAuthentication\backendCheckLogin(), and FrontendBackendUserAuthentication\checkBackendAccessSettingsFromInitPhp().

jsConfirmation (   $bitmask)

Returns TRUE or FALSE, depending if an alert popup (a javascript confirmation) should be shown call like $GLOBALS['BE_USER']->jsConfirmation($BITMASK).

Parameters
int$bitmaskBitmask, one of
Returns
bool TRUE if the confirmation should be shown
See also
JsConfirmation

Definition at line 1261 of file BackendUserAuthentication.php.

References Enumeration\cast(), and BackendUserAuthentication\getTSConfig().

logoff ( )

Logs out the current user and clears the form protection tokens.

Definition at line 2702 of file BackendUserAuthentication.php.

References FormProtectionFactory\get().

mayMakeShortcut ( )

Returns TRUE if the BE_USER is allowed to create shortcuts in the backend modules

Returns
bool

Definition at line 881 of file BackendUserAuthentication.php.

References BackendUserAuthentication\getTSConfigVal().

modAccess (   $conf,
  $exitOnError 
)

Checks access to a backend module with the $MCONF passed as first argument

Parameters
array$conf$MCONF array of a backend module!
bool$exitOnErrorIf set, an array will issue an error message and exit.
Exceptions
RuntimeException
Returns
bool Will return TRUE if $MCONF['access'] is not set at all, if the BE_USER is admin or if the module is enabled in the be_users/be_groups records of the user (specifically enabled). Will return FALSE if the module name is not even found in $TBE_MODULES

Definition at line 416 of file BackendUserAuthentication.php.

References BackendUserAuthentication\check(), GeneralUtility\inList(), BackendUserAuthentication\isAdmin(), and BackendUtility\isModuleSetInTBE_MODULES().

overrideUC ( )

Override: Call this function every time the uc is updated. That is 1) by reverting to default values, 2) in the setup-module, 3) userTS changes (userauthgroup)

Returns
void

Definition at line 2588 of file BackendUserAuthentication.php.

References BackendUserAuthentication\getTSConfigProp().

Referenced by BackendUserAuthentication\backendSetUC().

recordEditAccessInternals (   $table,
  $idOrRow,
  $newRecord = false,
  $deletedRecord = false,
  $checkFullLanguageAccess = false 
)

Checking if a user has editing access to a record from a $GLOBALS['TCA'] table. The checks does not take page permissions and other "environmental" things into account. It only deal with record internals; If any values in the record fields disallows it. For instance languages settings, authMode selector boxes are evaluated (and maybe more in the future). It will check for workspace dependent access. The function takes an ID (int) or row (array) as second argument.

Parameters
string$tableTable name
mixed$idOrRowIf integer, then this is the ID of the record. If Array this just represents fields in the record.
bool$newRecordSet, if testing a new (non-existing) record array. Will disable certain checks that doesn't make much sense in that context.
bool$deletedRecordSet, if testing a deleted record array.
bool$checkFullLanguageAccessSet, whenever access to all translations of the record is required
Returns
bool TRUE if OK, otherwise FALSE

Definition at line 742 of file BackendUserAuthentication.php.

References $GLOBALS, GeneralUtility\callUserFunction(), BackendUserAuthentication\checkAuthMode(), BackendUserAuthentication\checkFullLanguagesAccess(), BackendUserAuthentication\checkLanguageAccess(), BackendUtility\getRecord(), and BackendUserAuthentication\isAdmin().

resetUC ( )

Clears the user[uc] and ->uc to blank strings. Then calls ->backendSetUC() to fill it again with reset contents

Returns
void

Definition at line 2599 of file BackendUserAuthentication.php.

References BackendUserAuthentication\backendSetUC().

returnWebmounts ( )

Returns an array with the webmounts. If no webmounts, and empty array is returned. NOTICE: Deleted pages WILL NOT be filtered out! So if a mounted page has been deleted it is STILL coming out as a webmount. This is not checked due to performance.

Returns
array

Definition at line 1229 of file BackendUserAuthentication.php.

Referenced by BackendUserAuthentication\isInWebMount().

setCachedList (   $cList)

Updates the field be_users.usergroup_cached_list if the groupList of the user has changed/is different from the current list. The field "usergroup_cached_list" contains the list of groups which the user is a member of. After authentication (where these functions are called...) one can depend on this list being a representation of the exact groups/subgroups which the BE_USER has membership with.

Parameters
string$cListThe newly compiled group-list which must be compared with the current list in the user record and possibly stored if a difference is detected.
Returns
void private

Definition at line 1533 of file BackendUserAuthentication.php.

References GeneralUtility\makeInstance().

Referenced by BackendUserAuthentication\fetchGroupData().

setDefaultWorkspace ( )

Sets the default workspace in the context of the current backend user.

Returns
void

Definition at line 2218 of file BackendUserAuthentication.php.

References BackendUserAuthentication\checkWorkspace(), and BackendUserAuthentication\getDefaultWorkspace().

Referenced by BackendUserAuthentication\setWorkspace().

setTemporaryWorkspace (   $workspaceId)

Sets a temporary workspace in the context of the current backend user.

Parameters
int$workspaceId
Returns
bool

Definition at line 2199 of file BackendUserAuthentication.php.

References BackendUserAuthentication\checkWorkspace().

Referenced by BackendUserAuthentication\setWorkspace().

setWebmounts ( array  $mountPointUids,
  $append = false 
)

Initializes the given mount points for the current Backend user.

Parameters
array$mountPointUidsPage UIDs that should be used as web mountpoints
bool$appendIf TRUE the given mount point will be appended. Otherwise the current mount points will be replaced.
Returns
void

Definition at line 1241 of file BackendUserAuthentication.php.

References GeneralUtility\intExplode().

setWorkspace (   $workspaceId)

Setting workspace ID

Parameters
int$workspaceIdID of workspace to set for backend user. If not valid the default workspace for BE user is found and set.
Returns
void

Definition at line 2173 of file BackendUserAuthentication.php.

References BackendUserAuthentication\$workspace, GeneralUtility\makeInstance(), BackendUserAuthentication\setDefaultWorkspace(), BackendUserAuthentication\setTemporaryWorkspace(), and BackendUserAuthentication\simplelog().

Referenced by BackendUserAuthentication\workspaceInit().

setWorkspacePreview (   $previewState)

Setting workspace preview state for user:

Parameters
bool$previewStateState of user preview.
Returns
void

Definition at line 2230 of file BackendUserAuthentication.php.

References GeneralUtility\makeInstance().

simplelog (   $message,
  $extKey = '',
  $error = 0 
)

Simple logging function

Parameters
string$messageLog message
string$extKeyOption extension key / module name
int$errorError level. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
Returns
int Log entry UID

Definition at line 2359 of file BackendUserAuthentication.php.

References BackendUserAuthentication\writelog().

Referenced by BackendUserAuthentication\setWorkspace().

workspaceAllowAutoCreation (   $table,
  $id,
  $recpid 
)

Evaluates if auto creation of a version of a record is allowed.

Parameters
string$tableTable of the record
int$idUID of record
int$recpidPID of record
Returns
bool TRUE if ok.

Definition at line 1034 of file BackendUserAuthentication.php.

References $GLOBALS, AbstractUserAuthentication\$id, and BackendUtility\getWorkspaceVersionOfRecord().

workspaceAllowLiveRecordsInPID (   $pid,
  $table 
)

Check if "live" records from $table may be created or edited in this PID. If the answer is FALSE it means the only valid way to create or edit records in the PID is by versioning If the answer is 1 or 2 it means it is OK to create a record, if -1 it means that it is OK in terms of versioning because the element was within a versionized branch but NOT ok in terms of the state the root point had!

Parameters
int$pidPID value to check for. OBSOLETE!
string$tableTable name
Returns
mixed Returns FALSE if a live record cannot be created and must be versionized in order to do so. 2 means a) Workspace is "Live" or workspace allows "live edit" of records from non-versionized tables (and the $table is not versionizable). 1 and -1 means the pid is inside a versionized branch where -1 means that the branch-point did NOT allow a new record according to its state.

Definition at line 987 of file BackendUserAuthentication.php.

References $GLOBALS.

Referenced by BackendUserAuthentication\workspaceCannotEditRecord(), and BackendUserAuthentication\workspaceCreateNewRecord().

workspaceCannotEditOfflineVersion (   $table,
  $recData 
)

Evaluates if a user is allowed to edit the offline version

Parameters
string$tableTable of record
array | int$recDataInteger (record uid) or array where fields are at least: pid, t3ver_wsid, t3ver_stage (if versioningWS is set)
Returns
string String error code, telling the failure state. FALSE=All ok
See also
workspaceCannotEditRecord()

Definition at line 956 of file BackendUserAuthentication.php.

References $GLOBALS, BackendUtility\getRecord(), and BackendUserAuthentication\workspaceCannotEditRecord().

workspaceCannotEditRecord (   $table,
  $recData 
)

Checking if editing of an existing record is allowed in current workspace if that is offline. Rules for editing in offline mode:

  • record supports versioning and is an offline version from workspace and has the corrent stage
  • or record (any) is in a branch where there is a page which is a version from the workspace and where the stage is not preventing records
Parameters
string$tableTable of record
array | int$recDataInteger (record uid) or array where fields are at least: pid, t3ver_wsid, t3ver_stage (if versioningWS is set)
Returns
string String error code, telling the failure state. FALSE=All ok

Definition at line 898 of file BackendUserAuthentication.php.

References $GLOBALS, BackendUtility\getRecord(), BackendUserAuthentication\workspaceAllowLiveRecordsInPID(), and BackendUserAuthentication\workspaceCheckStageForCurrent().

Referenced by BackendUserAuthentication\workspaceCannotEditOfflineVersion().

workspaceCheckStageForCurrent (   $stage)

Checks if an element stage allows access for the user in the current workspace In live workspace (= 0) access is always granted for any stage. Admins are always allowed. An option for custom workspaces allows members to also edit when the stage is "Review"

Parameters
int$stageStage id from an element: -1,0 = editing, 1 = reviewer, >1 = owner
Returns
bool TRUE if user is allowed access

Definition at line 1059 of file BackendUserAuthentication.php.

References BackendUserAuthentication\$workspaceRec, BackendUserAuthentication\checkWorkspaceCurrent(), BackendUtility\getRecord(), GeneralUtility\inList(), and BackendUserAuthentication\isAdmin().

Referenced by BackendUserAuthentication\workspaceCannotEditRecord().

workspaceCreateNewRecord (   $pid,
  $table 
)

Evaluates if a record from $table can be created in $pid

Parameters
int$pidPage id. This value must be the _ORIG_uid if available: So when you have pages versionized as "page" or "element" you must supply the id of the page version in the workspace!
string$tableTable name
Returns
bool TRUE if OK.

Definition at line 1011 of file BackendUserAuthentication.php.

References $GLOBALS, and BackendUserAuthentication\workspaceAllowLiveRecordsInPID().

workspacePublishAccess (   $wsid)

Returns TRUE if the user has access to publish content from the workspace ID given. Admin-users are always granted access to do this If the workspace ID is 0 (live) all users have access also For custom workspaces it depends on whether the user is owner OR like with draft workspace if the user has access to Live workspace.

Parameters
int$wsidWorkspace UID; 0,1+
Returns
bool Returns TRUE if the user has access to publish content from the workspace ID given.

Definition at line 1124 of file BackendUserAuthentication.php.

References BackendUserAuthentication\checkWorkspace(), BackendUserAuthentication\isAdmin(), and Permission\PAGE_EDIT.

workspaceSwapAccess ( )

Workspace swap-mode access?

Returns
bool Returns TRUE if records can be swapped in the current workspace, otherwise FALSE

Definition at line 1155 of file BackendUserAuthentication.php.

writelog (   $type,
  $action,
  $error,
  $details_nr,
  $details,
  $data,
  $tablename = '',
  $recuid = '',
  $recpid = '',
  $event_pid = -1,
  $NEWid = '',
  $userId = 0 
)

Writes an entry in the logfile/table Documentation in "TYPO3 Core API"

Parameters
int$typeDenotes which module that has submitted the entry. See "TYPO3 Core API". Use "4" for extensions.
int$actionDenotes which specific operation that wrote the entry. Use "0" when no sub-categorizing applies
int$errorFlag. 0 = message, 1 = error (user problem), 2 = System Error (which should not happen), 3 = security notice (admin)
int$details_nrThe message number. Specific for each $type and $action. This will make it possible to translate errormessages to other languages
string$detailsDefault text that follows the message (in english!). Possibly translated by identification through type/action/details_nr
array$dataData that follows the log. Might be used to carry special information. If an array the first 5 entries (0-4) will be sprintf'ed with the details-text
string$tablenameTable name. Special field used by tce_main.php.
int | string$recuidRecord UID. Special field used by tce_main.php.
int | string$recpidRecord PID. Special field used by tce_main.php. OBSOLETE
int$event_pidThe page_uid (pid) where the event occurred. Used to select log-content for specific pages.
string$NEWidSpecial field used by tce_main.php. NEWid string of newly created records.
int$userIdAlternative Backend User ID (used for logging login actions where this is not yet known).
Returns
int Log entry ID.

Definition at line 2296 of file BackendUserAuthentication.php.

References $fields, GeneralUtility\getIndpEnv(), and GeneralUtility\makeInstance().

Referenced by BackendUserAuthentication\simplelog().

Member Data Documentation

$checkWorkspaceCurrent_cache = null
$dataLists
Initial value:
= [
'webmount_list' => ''

Definition at line 102 of file BackendUserAuthentication.php.

$enablecolumns
Initial value:
= [
'rootLevel' => 1

Definition at line 213 of file BackendUserAuthentication.php.

$errorMsg = ''

Definition at line 157 of file BackendUserAuthentication.php.

$filePermissions
protected
$fileStorages
protected
$firstMainGroup = 0

Definition at line 265 of file BackendUserAuthentication.php.

$formfield_status = 'login_status'

Definition at line 237 of file BackendUserAuthentication.php.

$formfield_uident = 'userident'

Definition at line 231 of file BackendUserAuthentication.php.

$formfield_uname = 'username'

Definition at line 225 of file BackendUserAuthentication.php.

$groupData
Initial value:
= [
'filemounts' => []
]

Definition at line 57 of file BackendUserAuthentication.php.

Referenced by BackendUserAuthentication\getFileMountRecords().

$groupList = ''

Definition at line 77 of file BackendUserAuthentication.php.

$includeGroupArray = []

Definition at line 121 of file BackendUserAuthentication.php.

$lastLogin_column = 'lastlogin'

Definition at line 208 of file BackendUserAuthentication.php.

$session_table = 'be_sessions'

Definition at line 179 of file BackendUserAuthentication.php.

$sessionTimeout = 6000

Definition at line 260 of file BackendUserAuthentication.php.

$TSdataArray = []

Definition at line 127 of file BackendUserAuthentication.php.

$uc
$uc_default
Initial value:
= [
'interfaceSetup' => ''

Definition at line 282 of file BackendUserAuthentication.php.

$user_table = 'be_users'

Definition at line 185 of file BackendUserAuthentication.php.

$usergroup_column = 'usergroup'

Definition at line 44 of file BackendUserAuthentication.php.

$usergroup_table = 'be_groups'

Definition at line 50 of file BackendUserAuthentication.php.

$userGroups = []

Definition at line 65 of file BackendUserAuthentication.php.

$userGroupsUID = []

Definition at line 71 of file BackendUserAuthentication.php.

$userid_column = 'uid'

Definition at line 203 of file BackendUserAuthentication.php.

$userident_column = 'password'

Definition at line 197 of file BackendUserAuthentication.php.

$username_column = 'username'

Definition at line 191 of file BackendUserAuthentication.php.

$userTS = []
$userTS_dontGetCached = false

Definition at line 151 of file BackendUserAuthentication.php.

$userTS_text = ''

Definition at line 133 of file BackendUserAuthentication.php.

$userTSUpdated = false

Definition at line 145 of file BackendUserAuthentication.php.

$workspace = -99
$workspaceRec = []
$writeAttemptLog = true

Definition at line 249 of file BackendUserAuthentication.php.

$writeStdLog = true

Definition at line 243 of file BackendUserAuthentication.php.