Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3443488
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3443488
Commits
7a9fc8a3
Commit
7a9fc8a3
authored
15 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#340652
by catch: added edit/delete terms permission per vocabulary.
parent
30fa81a7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/taxonomy/taxonomy.admin.inc
+3
-1
3 additions, 1 deletion
modules/taxonomy/taxonomy.admin.inc
modules/taxonomy/taxonomy.module
+26
-2
26 additions, 2 deletions
modules/taxonomy/taxonomy.module
with
29 additions
and
3 deletions
modules/taxonomy/taxonomy.admin.inc
+
3
−
1
View file @
7a9fc8a3
...
...
@@ -694,7 +694,9 @@ function taxonomy_form_term($form, &$form_state, $vocabulary, $edit = array()) {
if
(
$edit
[
'tid'
])
{
$form
[
'delete'
]
=
array
(
'#type'
=>
'submit'
,
'#value'
=>
t
(
'Delete'
));
'#value'
=>
t
(
'Delete'
),
'#access'
=>
user_access
(
"delete terms in
$vocabulary->vid
"
)
||
user_access
(
'administer taxonomy'
),
);
$form
[
'tid'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
$edit
[
'tid'
]);
...
...
This diff is collapsed.
Click to expand it.
modules/taxonomy/taxonomy.module
+
26
−
2
View file @
7a9fc8a3
...
...
@@ -10,12 +10,28 @@
* Implement hook_permission().
*/
function
taxonomy_permission
()
{
return
array
(
$permissions
=
array
(
'administer taxonomy'
=>
array
(
'title'
=>
t
(
'Administer taxonomy'
),
'description'
=>
t
(
'Manage taxonomy vocabularies and terms.'
),
),
);
foreach
(
taxonomy_get_vocabularies
()
as
$vocabulary
)
{
$permissions
+=
array
(
'edit terms in '
.
$vocabulary
->
vid
=>
array
(
'title'
=>
t
(
'Edit terms in %vocabulary'
,
array
(
'%vocabulary'
=>
$vocabulary
->
name
)),
'description'
=>
t
(
'Edit terms in the %vocabulary vocabulary.'
,
array
(
'%vocabulary'
=>
$vocabulary
->
name
)),
),
);
$permissions
+=
array
(
'delete terms in '
.
$vocabulary
->
vid
=>
array
(
'title'
=>
t
(
'Delete terms in %vocabulary'
,
array
(
'%vocabulary'
=>
$vocabulary
->
name
)),
'description'
=>
t
(
'Delete terms in the %vocabulary vocabulary.'
,
array
(
'%vocabulary'
=>
$vocabulary
->
name
)),
),
);
}
return
$permissions
;
}
/**
...
...
@@ -210,7 +226,8 @@ function taxonomy_menu() {
'title'
=>
'Edit term'
,
'page callback'
=>
'taxonomy_term_edit'
,
'page arguments'
=>
array
(
2
),
'access arguments'
=>
array
(
'administer taxonomy'
),
'access callback'
=>
'taxonomy_term_edit_access'
,
'access arguments'
=>
array
(
2
),
'type'
=>
MENU_LOCAL_TASK
,
'weight'
=>
10
,
'file'
=>
'taxonomy.pages.inc'
,
...
...
@@ -272,6 +289,13 @@ function taxonomy_menu() {
return
$items
;
}
/**
* Return edit access for a given term.
*/
function
taxonomy_term_edit_access
(
$term
)
{
return
user_access
(
"edit terms in
$term->vid
"
)
||
user_access
(
'administer taxonomy'
);
}
/**
* Return the vocabulary name given the vocabulary object.
*/
...
...
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