Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
a816fead
Commit
a816fead
authored
17 years ago
by
Gábor Hojtsy
Browse files
Options
Downloads
Patches
Plain Diff
#206078
by Pancho, traxer: order roles with system roles first (usability)
parent
a541e5fb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/user/user.admin.inc
+3
-11
3 additions, 11 deletions
modules/user/user.admin.inc
modules/user/user.module
+9
-6
9 additions, 6 deletions
modules/user/user.module
with
12 additions
and
17 deletions
modules/user/user.admin.inc
+
3
−
11
View file @
a816fead
...
...
@@ -6,7 +6,6 @@
* Admin page callback file for the user module.
*/
function
user_admin
(
$callback_arg
=
''
)
{
$op
=
isset
(
$_POST
[
'op'
])
?
$_POST
[
'op'
]
:
$callback_arg
;
...
...
@@ -514,16 +513,10 @@ function user_admin_perm($form_state, $rid = NULL) {
$role_permissions
[
$role
->
rid
]
=
$role
->
perm
.
','
;
}
// Retrieve role names for columns.
$role_names
=
user_roles
();
if
(
is_numeric
(
$rid
))
{
$result
=
db_query
(
'SELECT rid, name FROM {role} r WHERE r.rid = %d ORDER BY name'
,
$rid
);
}
else
{
$result
=
db_query
(
'SELECT rid, name FROM {role} ORDER BY name'
);
}
$role_names
=
array
();
while
(
$role
=
db_fetch_object
(
$result
))
{
$role_names
[
$role
->
rid
]
=
$role
->
name
;
$role_names
=
array
(
$rid
=>
$role_names
[
$rid
]);
}
// Render role/permission overview:
...
...
@@ -557,7 +550,6 @@ function user_admin_perm($form_state, $rid = NULL) {
return
$form
;
}
function
user_admin_perm_submit
(
$form
,
&
$form_state
)
{
// Save permissions:
$result
=
db_query
(
'SELECT * FROM {role}'
);
...
...
This diff is collapsed.
Click to expand it.
modules/user/user.module
+
9
−
6
View file @
a816fead
...
...
@@ -1628,8 +1628,12 @@ function _user_mail_text($key, $language = NULL, $variables = array()) {
* @return
* An associative array with the role id as the key and the role name as value.
*/
function
user_roles
(
$membersonly
=
0
,
$permission
=
0
)
{
$roles
=
array
();
function
user_roles
(
$membersonly
=
FALSE
,
$permission
=
FALSE
)
{
// System roles take the first two positions.
$roles
=
array
(
DRUPAL_ANONYMOUS_RID
=>
NULL
,
DRUPAL_AUTHENTICATED_RID
=>
NULL
,
);
if
(
$permission
)
{
$result
=
db_query
(
"SELECT r.* FROM
{
role
}
r INNER JOIN
{
permission
}
p ON r.rid = p.rid WHERE p.perm LIKE '%%%s%%' ORDER BY r.name"
,
$permission
);
...
...
@@ -1642,7 +1646,9 @@ function user_roles($membersonly = 0, $permission = 0) {
$roles
[
$role
->
rid
]
=
$role
->
name
;
}
}
return
$roles
;
// Filter to remove unmatched system roles.
return
array_filter
(
$roles
);
}
/**
...
...
@@ -2102,8 +2108,6 @@ function _user_password_dynamic_validation() {
}
}
/**
* Implementation of hook_hook_info().
*/
...
...
@@ -2381,4 +2385,3 @@ function _user_forms(&$edit, $account, $category, $hook = 'form') {
return
empty
(
$groups
)
?
FALSE
:
$groups
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment