Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
group_term
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
group_term
Commits
51cad51c
Commit
51cad51c
authored
2 years ago
by
Nikolay Lobachev
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3325941
: Remove access hook, we will use Access handler from teh group instead.
parent
3a336765
Branches
Branches containing commit
Tags
3.0.0-alpha1
Tags containing commit
1 merge request
!16
Issue #3332206 by LOBsTerr, kristiaanvandeneynde: GroupTermOperationProvider...
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
group_term.module
+0
-66
0 additions, 66 deletions
group_term.module
with
0 additions
and
66 deletions
group_term.module
+
0
−
66
View file @
51cad51c
...
...
@@ -41,69 +41,3 @@ function group_term_entity_operation(EntityInterface $entity) {
}
return
$operations
;
}
///**
// * Implements hook_ENTITY_TYPE_access().
// *
// * When trying to view, update or delete a term it suffices to have the right to
// * do so in only one group the term belongs to. If you wish to prevent any such
// * action on your own terms, implement hook_taxonomy_term_access() in your
// * module.
// */
//function group_term_taxonomy_term_access(EntityInterface $term, $op, AccountInterface $account) {
// // We do not care about create access as we have our own wizard for that. Any
// // operation aside from 'view', 'update' and 'delete' is also unsupported.
// if (!in_array($op, ['view', 'update', 'delete'])) {
// return AccessResult::neutral();
// }
//
// $plugin_id = 'group_term:' . $term->bundle();
//
// // Only act if there are group content types for this vocabulary.
// $group_content_types = GroupRelationshipType::loadByContentPluginId($plugin_id);
// if (empty($group_content_types)) {
// return AccessResult::neutral();
// }
//
// // Load all the group content for this term.
// $group_contents = \Drupal::entityTypeManager()
// ->getStorage('group_content')
// ->loadByProperties([
// 'type' => array_keys($group_content_types),
// 'entity_id' => $term->id(),
// ]);
//
// // If the term does not belong to any group, we have nothing to say.
// if (empty($group_contents)) {
// return AccessResult::neutral();
// }
//
// // From this point on you need group to allow you to perform the operation.
// foreach ($group_contents as $group_content) {
// $group = $group_content->getGroup();
// switch ($op) {
// case 'view':
// if ($group->hasPermission("view $plugin_id entity", $account)) {
// return AccessResult::allowed();
// }
// break;
//
// case 'update':
// if ($group->hasPermission("update any $plugin_id entity", $account)) {
// return AccessResult::allowed();
// }
// break;
//
// case 'delete':
// if ($group->hasPermission("delete any $plugin_id entity", $account)) {
// return AccessResult::allowed();
// }
// break;
// }
// }
//
// // Instead of outright forbidding access when no group granted it, we return
// // a neutral access result to play nice with other modules. If the end result
// // is still neutral, Drupal will deny access anyway.
// return AccessResult::neutral();
//}
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