Privileges
class Privileges (View source)
Privileges class
Methods
No description
Escapes wildcard in a database+table specification before using it in a GRANT statement.
Add slashes before "_" and "%" characters for using them in MySQL database, table and field names.
removes slashes before "_" and "%" characters Note: This function does not unescape backslashes!
Generates a condition on the user name
Parses privileges into an array, it modifies the array
Extracts the privilege information of a priv table row
Returns an array of table grants and their descriptions
Get the grants array which contains all the privilege types and relevant grant messages
Get sql query for display privileges table
Sets the user group from request values
Displays the privileges form table
Get the HTML snippet for routine specific privileges
Displays the fields used by the "new user" form as well as the "change login information / copy user" form.
Get username and hostname length
Get current authentication plugin in use for a user
Get the default authentication plugin
Returns all the grants for a certain user on a certain host Used in the export privileges for all users section
Update password and get message for password updating
Revokes privileges and get message and SQL query for privileges revokes
Get REQUIRE clause
Get a WITH clause for 'update privileges' and 'add user'
Get HTML for addUsersForm, This function call if isset($_GET['adduser'])
Returns edit, revoke or export link for a user.
Returns number of defined user groups
Returns name of user group that user is part of
This function return the extra data array for the ajax behavior
no db name given, so we want all privs for the given user db name was given, so we want all user specific rights for this db So this function returns user rights as an array
Parses Proc_priv data
Get a HTML table for display user's table specific or database specific rights
Get HTML for display the users overview (if less than 50 users, display them immediately)
Displays the initials if there are many privileges
Get the database rights array for Display user overview
Delete user and get message and sql query for delete user in privileges
Update the privileges and return the success or error message
Get List of information: Changes / copies a user
Update Data for information: Deletes users
update Message For Reload
update Data For Queries from queries_for_display
update Data for information: Adds a user
Sets proper value of old_passwords
according to
the authentication plugin selected
Get title and textarea for export user definition in Privileges
Get HTML snippet for display user overview page
Get HTML snippet for display user properties
Get queries for Table privileges to change or copy user
Get queries for database specific privileges for change or copy user
Prepares queries for adding users and also create database and return query and message
Get the hashed string for password
Get SQL queries for Display and Add user
Returns the type ('PROCEDURE' or 'FUNCTION') of the routine
No description
No description
No description
Details
__construct(Template $template, DatabaseInterface $dbi, Relation $relation, RelationCleanup $relationCleanup, Plugins $plugins, Config $config)
No description
string
wildcardEscapeForGrant(string $dbname, string $tablename)
Escapes wildcard in a database+table specification before using it in a GRANT statement.
Escaping a wildcard character in a GRANT is only accepted at the global or database level, not at table level; this is why I remove the escaping character. Internally, in mysql.tables_priv.Db there are no escaping (for example test_db) but in mysql.db you'll see test_db for a db-specific privilege.
string
escapeGrantWildcards(string $name)
Add slashes before "_" and "%" characters for using them in MySQL database, table and field names.
Note: This function does not escape backslashes!
string
unescapeGrantWildcards(string $name)
removes slashes before "_" and "%" characters Note: This function does not unescape backslashes!
string
rangeOfUsers(string|null $initial = null)
Generates a condition on the user name
void
fillInTablePrivileges(array $row)
Parses privileges into an array, it modifies the array
array
extractPrivInfo(array|null $row = null, bool $enableHTML = false, bool $tablePrivs = false)
Extracts the privilege information of a priv table row
array
getTableGrantsArray()
Returns an array of table grants and their descriptions
array
getGrantsArray()
Get the grants array which contains all the privilege types and relevant grant messages
string
getSqlQueryForDisplayPrivTable(string $db, string $table, string $username, string $hostname)
Get sql query for display privileges table
void
setUserGroup(string $username, string $userGroup)
Sets the user group from request values
string
getHtmlToDisplayPrivilegesTable(string $db = '*', string $table = '*', bool $submit = true)
Displays the privileges form table
string
getHtmlForRoutineSpecificPrivileges(string $username, string $hostname, string $db, string $routine, string $urlDbname)
Get the HTML snippet for routine specific privileges
string
getHtmlForLoginInformationFields(string|null $user = null, string|null $host = null)
Displays the fields used by the "new user" form as well as the "change login information / copy user" form.
array
getUsernameAndHostnameLength()
Get username and hostname length
string
getCurrentAuthenticationPlugin(string $username, string $hostname)
Get current authentication plugin in use for a user
string|null
getDefaultAuthenticationPlugin()
Get the default authentication plugin
string
getGrants(string $user, string $host)
Returns all the grants for a certain user on a certain host Used in the export privileges for all users section
Message
updatePassword(string $errorUrl, string $username, string $hostname)
Update password and get message for password updating
array
getMessageAndSqlQueryForPrivilegesRevoke(string $dbname, string $tablename, string $username, string $hostname, string $itemType)
Revokes privileges and get message and SQL query for privileges revokes
string
getRequireClause()
Get REQUIRE clause
string
getWithClauseForAddUserAndUpdatePrivs()
Get a WITH clause for 'update privileges' and 'add user'
string
getHtmlForAddUser(string $dbname)
Get HTML for addUsersForm, This function call if isset($_GET['adduser'])
array
getAllPrivileges(DatabaseName $db, TableName|null $table = null)
No description
string
getUserLink(string $linktype, string $username, string $hostname, string $dbname = '', string $tablename = '', string $routinename = '', string $initial = '')
Returns edit, revoke or export link for a user.
int
getUserGroupCount(ConfigurableMenusFeature $configurableMenusFeature)
Returns number of defined user groups
string|null
getUserGroupForUser(string $username)
Returns name of user group that user is part of
array
getExtraDataForAjaxBehavior(string $password, string $sqlQuery, string $hostname, string $username, string|null $dbname)
This function return the extra data array for the ajax behavior
array
getUserSpecificRights(string $username, string $hostname, string $type, string $dbname = '')
no db name given, so we want all privs for the given user db name was given, so we want all user specific rights for this db So this function returns user rights as an array
array
parseProcPriv(string $privs)
Parses Proc_priv data
string
getHtmlForAllTableSpecificRights(string $username, string $hostname, string $type, string $dbname = '')
Get a HTML table for display user's table specific or database specific rights
string
getUsersOverview(ResultInterface $result, array $dbRights)
Get HTML for display the users overview (if less than 50 users, display them immediately)
string
getHtmlForInitials()
Displays the initials if there are many privileges
array
getDbRightsForUserOverview(string|null $initial)
Get the database rights array for Display user overview
array
deleteUser(array $queries)
Delete user and get message and sql query for delete user in privileges
array
updatePrivileges(string $username, string $hostname, string $tablename, string $dbname, string $itemType)
Update the privileges and return the success or error message
string|null
getDataForChangeOrCopyUser(string $oldUsername, string $oldHostname)
Get List of information: Changes / copies a user
array
getDataForDeleteUsers(array $queries)
Update Data for information: Deletes users
Message|null
updateMessageForReload()
update Message For Reload
array
getDataForQueries(array $queries, array|null $queriesForDisplay)
update Data For Queries from queries_for_display
array
addUser(string $dbname, string $username, string $hostname, string|null $password, bool $isMenuwork)
update Data for information: Adds a user
void
setProperPasswordHashing(string $authPlugin)
Sets proper value of old_passwords
according to
the authentication plugin selected
string
getExportUserDefinitionTextarea(string $username, string $hostname, array|null $selectedUsers)
Get title and textarea for export user definition in Privileges
string
getHtmlForUserOverview(UserPrivileges $userPrivileges, string|null $initial)
Get HTML snippet for display user overview page
string
getHtmlForUserProperties(bool $dbnameIsWildcard, string $urlDbname, string $username, string $hostname, string|array $dbname, string $tablename, string $route)
Get HTML snippet for display user properties
array
getTablePrivsQueriesForChangeOrCopyUser(string $userHostCondition, array $queries, string $username, string $hostname)
Get queries for Table privileges to change or copy user
array
getDbSpecificPrivsQueriesForChangeOrCopyUser(array $queries, string $username, string $hostname, string $oldUsername, string $oldHostname)
Get queries for database specific privileges for change or copy user
array
addUserAndCreateDatabase(bool $error, string $realSqlQuery, string $sqlQuery, string $username, string $hostname, string $dbname, string $alterRealSqlQuery, string $alterSqlQuery, bool $createDb1, bool $createDb2, bool $createDb3)
Prepares queries for adding users and also create database and return query and message
string
getHashedPassword(string $password)
Get the hashed string for password
array
getSqlQueriesForDisplayAndAddUser(string $username, string $hostname, string $password)
Get SQL queries for Display and Add user
string
getRoutineType(string $dbname, string $routineName)
Returns the type ('PROCEDURE' or 'FUNCTION') of the routine
string
getFormForChangePassword(string $username, string $hostname, bool $editOthers, string $route)
No description
string
getHostname(string $predHostname, string $globalHostname)
No description
bool
isDatabaseNameWildcard(mixed $dbname)
No description
string|null
getRoutinename(ServerRequest $request)
No description
string|null
getTablename(ServerRequest $request)
No description
string|array|null
getDbname(ServerRequest $request)
No description
string|null
getHostnameParam(ServerRequest $request)
No description
string|null
getUsernameParam(ServerRequest $request)
No description