Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions administrator/components/com_users/src/Model/LevelModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,15 @@ protected function canDelete($record)
$tables = $db->getTableList();
$prefix = $db->getPrefix();

// Collect table names for error message
$inTables = [];

foreach ($tables as $table) {
// Get all of the columns in the table
$fields = $db->getTableColumns($table);

/**
* We are looking for the access field. If custom tables are using something other
* We are looking for the access field. If custom tables are using something other
* than the 'access' field they are on their own unfortunately.
* Also make sure the table prefix matches the live db prefix (eg, it is not a "bak_" table)
*/
Expand All @@ -103,8 +106,10 @@ protected function canDelete($record)

$this->levelsInUse = array_merge($this->levelsInUse, $values);

// @todo Could assemble an array of the tables used by each view level list those,
// giving the user a clue in the error where to look.
// Check if the table uses this access level
if (in_array($record->id, $values)) {
$inTables[] = $table;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion administrator/language/en-GB/com_users.ini
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ COM_USERS_ERROR_LEVELS_NOLEVELS_SELECTED="No View Permission Level(s) selected."
COM_USERS_ERROR_NO_ADDITIONS="The selected user(s) are already assigned to the selected group."
COM_USERS_ERROR_NOT_IN_GROUP="The selected user(s) are not in the selected group."
COM_USERS_ERROR_ONLY_ONE_GROUP="A user must belong to at least one group."
COM_USERS_ERROR_VIEW_LEVEL_IN_USE="You can't delete the view access level '%d:%s' because it is being used by content."
COM_USERS_ERROR_VIEW_LEVEL_IN_USE="You can't delete the view access level '%s' because it is being used in the database tables: %s."
COM_USERS_FIELDS_USER_FIELDS_TITLE="Users: Fields"
COM_USERS_FIELDS_USER_FIELD_ADD_TITLE="Users: New Field"
COM_USERS_FIELDS_USER_FIELD_EDIT_TITLE="Users: Edit Field"
Expand Down