Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
290
Merge Requests
290
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
30b69380
Commit
30b69380
authored
Sep 17, 2004
by
Steven Wittens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-
#10689
: Group permissions by module in UI + minor code cleanups.
- Adding a drupal_goto to the block admin.
parent
4b992626
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
30 deletions
+54
-30
misc/drupal.css
misc/drupal.css
+6
-0
modules/block.module
modules/block.module
+1
-0
modules/block/block.module
modules/block/block.module
+1
-0
modules/user.module
modules/user.module
+23
-15
modules/user/user.module
modules/user/user.module
+23
-15
No files found.
misc/drupal.css
View file @
30b69380
...
...
@@ -333,6 +333,12 @@ tr.light .form-item, tr.dark .form-item {
#forum
td
.posts
,
#forum
td
.topics
,
#forum
td
.replies
,
#forum
td
.pager
{
text-align
:
center
;
}
#permissions
td
.module
{
font-weight
:
bold
;
}
#permissions
td
.permission
{
padding-left
:
2em
;
}
.poll
.bar
{
height
:
1em
;
margin
:
1px
0
;
...
...
modules/block.module
View file @
30b69380
...
...
@@ -282,6 +282,7 @@ function block_admin() {
if
(
$op
==
t
(
'Save blocks'
))
{
drupal_set_message
(
block_admin_save
(
$edit
));
cache_clear_all
();
drupal_goto
(
$_GET
[
'q'
]);
}
print
theme
(
'page'
,
block_admin_display
());
}
...
...
modules/block/block.module
View file @
30b69380
...
...
@@ -282,6 +282,7 @@ function block_admin() {
if
(
$op
==
t
(
'Save blocks'
))
{
drupal_set_message
(
block_admin_save
(
$edit
));
cache_clear_all
();
drupal_goto
(
$_GET
[
'q'
]);
}
print
theme
(
'page'
,
block_admin_display
());
}
...
...
modules/user.module
View file @
30b69380
...
...
@@ -1379,9 +1379,13 @@ function user_admin_perm($edit = array()) {
// Delete, so if we clear every checkbox we reset that role;
// otherwise permissions are active and denied everywhere.
db_query
(
'DELETE FROM {permission} WHERE rid = %d'
,
$role
->
rid
);
$perm
=
$edit
[
$role
->
rid
]
?
implode
(
', '
,
array_keys
(
$edit
[
$role
->
rid
]))
:
''
;
if
(
$perm
)
{
db_query
(
"INSERT INTO
{
permission
}
(rid, perm) VALUES (%d, '%s')"
,
$role
->
rid
,
$perm
);
foreach
(
$edit
[
$role
->
rid
]
as
$key
=>
$value
)
{
if
(
!
$value
)
{
unset
(
$edit
[
$role
->
rid
][
$key
]);
}
}
if
(
count
(
$edit
[
$role
->
rid
]))
{
db_query
(
"INSERT INTO
{
permission
}
(rid, perm) VALUES (%d, '%s')"
,
$role
->
rid
,
implode
(
', '
,
array_keys
(
$edit
[
$role
->
rid
])));
}
}
...
...
@@ -1389,11 +1393,9 @@ function user_admin_perm($edit = array()) {
// permissions.
cache_clear_all
();
menu_rebuild
();
}
// Compile permission array:
$perms
=
module_invoke_all
(
'perm'
);
asort
(
$perms
);
drupal_goto
(
$_GET
[
'q'
]);
}
// Compile role array:
$result
=
db_query
(
'SELECT r.rid, p.perm FROM {role} r LEFT JOIN {permission} p ON r.rid = p.rid ORDER BY name'
);
...
...
@@ -1409,18 +1411,24 @@ function user_admin_perm($edit = array()) {
}
// Render role/permission overview:
$header
=
array_merge
(
array
(
'
'
),
$role_names
);
$header
=
array_merge
(
array
(
'
permission
'
),
$role_names
);
foreach
(
$perms
as
$perm
)
{
$row
[]
=
t
(
$perm
);
foreach
(
$role_names
as
$rid
=>
$name
)
{
$row
[]
=
"<input type=
\"
checkbox
\"
name=
\"
edit[
$rid
][
$perm
]
\"
"
.
(
strstr
(
$role_perms
[
$rid
],
$perm
)
?
' checked="checked"'
:
''
)
.
' />'
;
foreach
(
module_list
()
as
$module
)
{
if
(
$perms
=
module_invoke
(
$module
,
'perm'
))
{
$rows
[]
=
array
(
array
(
'data'
=>
t
(
'%module module'
,
array
(
'%module'
=>
$module
)),
'class'
=>
'module'
,
'colspan'
=>
count
(
$role_names
)
+
1
));
asort
(
$perms
);
foreach
(
$perms
as
$perm
)
{
$row
[]
=
array
(
'data'
=>
t
(
$perm
),
'class'
=>
'permission'
);
foreach
(
$role_names
as
$rid
=>
$name
)
{
$row
[]
=
form_checkbox
(
''
,
"
$rid
][
$perm
"
,
1
,
strstr
(
$role_perms
[
$rid
],
$perm
));
}
$rows
[]
=
$row
;
unset
(
$row
);
}
}
$rows
[]
=
$row
;
unset
(
$row
);
}
$output
=
theme
(
'table'
,
$header
,
$rows
);
$output
=
theme
(
'table'
,
$header
,
$rows
,
array
(
'id'
=>
'permissions'
)
);
$output
.
=
form_submit
(
t
(
'Save permissions'
));
return
form
(
$output
);
...
...
modules/user/user.module
View file @
30b69380
...
...
@@ -1379,9 +1379,13 @@ function user_admin_perm($edit = array()) {
// Delete, so if we clear every checkbox we reset that role;
// otherwise permissions are active and denied everywhere.
db_query
(
'DELETE FROM {permission} WHERE rid = %d'
,
$role
->
rid
);
$perm
=
$edit
[
$role
->
rid
]
?
implode
(
', '
,
array_keys
(
$edit
[
$role
->
rid
]))
:
''
;
if
(
$perm
)
{
db_query
(
"INSERT INTO
{
permission
}
(rid, perm) VALUES (%d, '%s')"
,
$role
->
rid
,
$perm
);
foreach
(
$edit
[
$role
->
rid
]
as
$key
=>
$value
)
{
if
(
!
$value
)
{
unset
(
$edit
[
$role
->
rid
][
$key
]);
}
}
if
(
count
(
$edit
[
$role
->
rid
]))
{
db_query
(
"INSERT INTO
{
permission
}
(rid, perm) VALUES (%d, '%s')"
,
$role
->
rid
,
implode
(
', '
,
array_keys
(
$edit
[
$role
->
rid
])));
}
}
...
...
@@ -1389,11 +1393,9 @@ function user_admin_perm($edit = array()) {
// permissions.
cache_clear_all
();
menu_rebuild
();
}
// Compile permission array:
$perms
=
module_invoke_all
(
'perm'
);
asort
(
$perms
);
drupal_goto
(
$_GET
[
'q'
]);
}
// Compile role array:
$result
=
db_query
(
'SELECT r.rid, p.perm FROM {role} r LEFT JOIN {permission} p ON r.rid = p.rid ORDER BY name'
);
...
...
@@ -1409,18 +1411,24 @@ function user_admin_perm($edit = array()) {
}
// Render role/permission overview:
$header
=
array_merge
(
array
(
'
'
),
$role_names
);
$header
=
array_merge
(
array
(
'
permission
'
),
$role_names
);
foreach
(
$perms
as
$perm
)
{
$row
[]
=
t
(
$perm
);
foreach
(
$role_names
as
$rid
=>
$name
)
{
$row
[]
=
"<input type=
\"
checkbox
\"
name=
\"
edit[
$rid
][
$perm
]
\"
"
.
(
strstr
(
$role_perms
[
$rid
],
$perm
)
?
' checked="checked"'
:
''
)
.
' />'
;
foreach
(
module_list
()
as
$module
)
{
if
(
$perms
=
module_invoke
(
$module
,
'perm'
))
{
$rows
[]
=
array
(
array
(
'data'
=>
t
(
'%module module'
,
array
(
'%module'
=>
$module
)),
'class'
=>
'module'
,
'colspan'
=>
count
(
$role_names
)
+
1
));
asort
(
$perms
);
foreach
(
$perms
as
$perm
)
{
$row
[]
=
array
(
'data'
=>
t
(
$perm
),
'class'
=>
'permission'
);
foreach
(
$role_names
as
$rid
=>
$name
)
{
$row
[]
=
form_checkbox
(
''
,
"
$rid
][
$perm
"
,
1
,
strstr
(
$role_perms
[
$rid
],
$perm
));
}
$rows
[]
=
$row
;
unset
(
$row
);
}
}
$rows
[]
=
$row
;
unset
(
$row
);
}
$output
=
theme
(
'table'
,
$header
,
$rows
);
$output
=
theme
(
'table'
,
$header
,
$rows
,
array
(
'id'
=>
'permissions'
)
);
$output
.
=
form_submit
(
t
(
'Save permissions'
));
return
form
(
$output
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment