- Issue created by @lmaero
- 🇺🇸United States john.oltman
Can you post the permissions currently assigned to the role, so I can help you. There isn't enough information here yet. Also please post which submodules of Registration, if any, are enabled on your site (Registration Workflow, etc). Thank you.
Hi John and thanks for feedback!
The following rights are in place.
- Registrations:
• view, edit and delete own ....
• manage registrations of this type for host entities to which a user have edit access
• allow of sending email to registrants ...
• self registration
• show onw registrations
• show all registrations
- both of the Registration Workflow permissions- update own comments
- delete own comments
- show comments
- delete own articles
- delete ... of any content type
- content moderation: change to publish, change to template, ... archive
- use contextual links
- Flag: use bookmarks, use follow
- Polls: create pools, ....
- delete own private message
- some for media and file access permissions- 🇺🇸United States john.oltman
Thanks for that info. Typically, the ability to create content is reserved for "trusted" users, e.g. a "staff" role, where the staff can be directed not to register. That doesn't sound like the case for your site - however a custom module with a small amount of code can prevent users from registering for content they authored. If you are interested I can post some code here for you, let me know.
I agree that an option that would prevent users from being able to complete their own registrations is a general use case that is missing - there will be a new release of this module in 2-3 weeks, I'll add that option soon so it can be in that release. I will adjust the title of this issue to be more clear.
If I have misunderstood your "ask" please let me know.
Hi John, really nice if you can do!!!
It´s realy a great extension. Yes you understood right. This role is not a staff one, more something between standard user and stuff.
When you can post the code and in addition I check the next version in a few weeks.
I´m happy than.- 🇺🇸United States john.oltman
Here is some code you can put in a custom module:
use Drupal\Core\Access\AccessResult; use Drupal\Core\Session\AccountInterface; use Drupal\registration\HostEntityInterface; use Drupal\user\EntityOwnerInterface; /** * Implements hook_registration_create_access(). */ function mymodule_registration_create_access(AccountInterface $account, array $context, $entity_bundle) { $access_result = AccessResult::neutral(); $parameters = \Drupal::routeMatch()->getParameters(); $host_entity = \Drupal::service('registration.manager')->getEntityFromParameters($parameters, TRUE); if ($host_entity instanceof HostEntityInterface) { if ($entity = $host_entity->getEntity()) { if ($entity instanceof EntityOwnerInterface) { if ($owner_id = $entity->getOwnerId()) { if ($owner_id == \Drupal::currentUser()->id()) { // Disable registration for content the user authored. $access_result = AccessResult::forbidden(); } $access_result ->cachePerUser() ->addCacheableDependency($host_entity); } } } } return $access_result; }
Many thanks John!
I create a custom module with the same dependencies as in Registarations.
No errors no complications, but nothing different like before in registration workflow.
Maybe I forget something.
Needs the dependencies and entry to the Registration module?- 🇺🇸United States john.oltman
Browse to content you authored and you should not be able to register for it. Make sure you enabled your module and cleared cache first. It does not change workflow that will happen in the next release.
yes, clear cash is always the first task, I do.
Check it later again. When it dosen`t work, I wait for the next release.- Merge request !142#3513232: Add option to prevent workflow completion of own registrations → (Merged) created by john.oltman
-
john.oltman →
authored f59c1f5f on 3.4.x
#3513232: Add option to prevent workflow completion of own registrations
-
john.oltman →
authored f59c1f5f on 3.4.x
- 🇺🇸United States john.oltman
Committed to dev branch and will be in the next release in a week or so.
Thanks John, I install next a fresh drupal and wait for the new release.
Automatically closed - issue fixed for 2 weeks with no activity.