Closed (duplicate)
Project:
Form mode manager
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Dec 2016 at 04:49 UTC
Updated:
20 Dec 2016 at 12:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
woprrr commentedHi psiegel,
Just to explain you about the differences on these two modules manager ET contrôle are totally and architecturally différents for LE control are builds in d7 style with form alter but it's simple. Form mode manager provide new routes collections (with permissions ) allow to restrict totally the access in form mode by defaults but you can allow access on permissions provide by form mode ma anger by example if you use article and don't allow access on this bundle no problems if you add the permission "use my custom form mode" my custom is my new form mode my user cannot use article default but can contribute with add/article/my_custom without problems.
But you idea is good we can add two checks 1 if we have access to these bundle by default and another to show more simply "use default form mode" to do that feature more explicitly.
What do you think?
Comment #3
psiegel commentedHello and thanks for getting back that quickly,
I think the "add/article/my_custom" solution doesn't work. What I have tried is to remove the permission to edit and create from a role an then acces/ edit a node with the mode form link, in my case I have a role editor who has access to the mode form "form_mode_t01_editor", when I try node/7/form_mode_t01_editor I get "You are not authorized to access this page", which was making sense in D7 but from what I understand from your example it should work.
I am currently not looking for anything specific, but have decided to get a close look at D8 and see how close to the D7 functionalities I can edit, especially in terms of administration and editing experience. I am planning to spend a few weeks on checking things out.
To give an simple example I would like a "Site Admins" role to be able to edit the title and body, but "Editors" role can only edit the body. It is certainly doable with modules like field_permission or page manager or even DS, I still need to explore this. But I think it is cleaner to do it with this module.
Best,
Pascal
Comment #4
woprrr commented@psiegel,
Thank for your feedback but i need to verify ATM i am really busy on Media entity & media modules efforts but i need to pass this module stable. We need to add unit test to finish this module...
For you example this module permit that, see https://www.youtube.com/watch?v=ukx_UUn3StM&list=PLI6celP4IrvLSY-VJdCJrF...
I come with you about an example more specific to possible combine with permissions.
Comment #5
psiegel commentedI watch the video, the original edit form is present and available to the user. Just to clarify, my idea is for a user to have access only to the "Simple Form" and not to the original Edit form or the contributor form.
Comment #6
woprrr commentedYep @psiegel,
I seen your demand ;) and it's exactly for what i ve push my effort to code these module with routes / permissions / controller instead of form_alter Like form mode control. These module are fully based on routing / plugins system provide by Symfony concepts. That permit to have an module more flexible more maintainable and compatible with future version of Drupal (9) too !
For your case it's simple that patch do fixe your request ;) Just we need to solve other entities cases (ATM i assume that patch only fixe Node case because the route naming are not standard in Drupal 8 (SADLLY :() we need to found an generic solution to determine the name of route but i not have more time to found a robust & safe solution.
But can you test that patch please ?
Reproduce path :
1 : Create you Form mode
2 : Edit the access right (Node bundle acces + new permission "Use Defautl form mode for Node entity".
3 : Take that access to your role (contributor in my case) i not check "Use Defautl form mode for Node entity" for my contributor role.
4 : Go in classic Add page (i don't see classic "add content / edit" but i see my "add as contributor" and i can contribute only in this role and not default role.
5 : Have fun :D
Comment #7
psiegel commentedHello,
Thanks for the patch. Unfortunately I have issues to apply it, see below. I run from the root directory of the module (PHP 5.6 on ubuntu 14 LTS). The module version I have is the dev from Dec 9, I have also tried it with the previous dev version from dec 04, but I got PHP errors in my apache logs. I also try to apply the changes manually but just got more PHP errors :(
patch -p1 < remove_the_default_edit-2833894-6.patch
patching file src/Controller/FormModeManagerController.php
Hunk #1 FAILED at 173.
1 out of 1 hunk FAILED -- saving rejects to file src/Controller/FormModeManagerController.php.rej
patching file src/FormModeManagerPermissions.php
Hunk #1 succeeded at 68 (offset -3 lines).
The next patch would create the file src/ParamConverter/FormModeManagerConverter.php,
which already exists! Assume -R? [n]
Apply anyway? [n] y
patching file src/ParamConverter/FormModeManagerConverter.php
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file src/ParamConverter/FormModeManagerConverter.php.rej
patching file src/Routing/FormModeManagerRouteSubscriber.php
Hunk #1 succeeded at 74 (offset -5 lines).
Comment #8
woprrr commentedYes it's normal after last two commits in Dev branch that is too older to apply this patch. I re-patch, just one thougt i think now "add content" are not hiden but juste access denied ATM i am not really available to continue investigations, can you test it and tell me if is ok for your case ? (on edit mode too we need to add an custom access right).
Comment #9
woprrr commentedhi @psiegel,
That sould be good now.
But that is an FAST fix for Node case. I need to simplify a lot and do an route build / rebuild more intelligent ! ATM that patch work with you needed feature. The Optimisation Do make in another Issue.
Comment #10
psiegel commentedHello,
Patch remove_the_default_edit-2833894-9.patch is working, thanks.
I have done some testing and it seems to work fine (apologies about the delay, I missed your post with the new patch). This is a really useful module, thanks a lot.
Below are a few issues and comments:
1) there is a typo in the permission in “default” -> default
2) Is it possible to split the default permission for node entity by content type and add one permission per content type (and leave the default node entity. It is not an issue since I can create a default mode for each content type content type and remove the default node entity permission but it would be "a nice to have", and avoid create a form mode just to have a default
3) I tested with 2 content type: test01 and test 02. When going to /admin/content --> click on add content for test02 --> /node/add-list/form_mode_default_test02 it is showing 2 links:
1) test01 (node/add-list/form_mode_default_test02) and
2) test02 (node/add/test02/form_mode_default_test02)
I suppose the node/add-list/form_mode_default_test02 should go to the edit form directly and not show a page with the 2 links.
4) The user admin (uid 1) gets all the tabs on the node view form, it can be a lot of tabs and a bit confusing if the edit forms have the same label (like "Edit" for all forms modes), and since I cannot remove the default permission from the Administrator role, there can be easily 10 edit tabs. It is not very important and I don't think you can do anything about it, just mentioning it.
5) Another nice to have functionality would be to have a weigth system that would allow to order which form is used. Example: a content type has 3 forms: (A: weight=5, B: weight=0 and C:weight=-5). User Editor has the permission on A and B, he gets the form B, not the A. The User “Siteadmin” has access to form A, B and C. he gets to Form C, User X has permission only on A, he gets A. Nice to have and would also solve the many tab issue for the UID 1.
6) Not an issue, just a note that when a field is required and the field is not in the form, the node is still saved. This is something to pay attention to when creating mode forms and limiting access to some fields.
7) Small typo on the module list, the FormModeManager examples module name should be with spaces.
On another note I have posted this issue: Authoring Information and Promotions Options require Administer content permission https://www.drupal.org/node/2834195 , and was wondering if you have any idea. Does look like the issue isn't interesting to anyone!
Best,
Pascal
Comment #11
woprrr commentedHii @psiegel,
JUST YOU ARE SUPER HERO FOR ME !!! Because i don't have big time to continue to refactor this module and you take me LOT of courage to continue and take the first totally stable version !!! I promise next week i do it i my holiday !!
I close that issue just for centralise all changes in same issue. I ve process lot changes on #2834768: Route alteration refactor and backported all changes in this issue onto.
Actually i do continue another work i respond you other point after ;) You can test changes on #2834768: Route alteration refactor that have a lot of changes ;)
Comment #12
woprrr commentedComment #13
woprrr commentedI close that issue for benefits by other more clean. Thanks psiegel for your help in this module that is good motivation !! Credits in refactor issue :)