adrian

Restrict Tab View

Recommended Posts

Hi everyone,

Here's a quick little module that I hope you'll find useful. NB It requires PW 2.5.16 (or late 2.5.15 - this is the exact commit)

It allows you can control display of the various Page Edit tabs by user permissions. So if you want to always hide the Settings tab for users of a particular role across all templates, this should come in handy.

http://modules.processwire.com/modules/restrict-tab-view/

https://github.com/adrianbj/RestrictTabView

post-985-0-64275800-1427483636_thumb.png

You can approach this from two directions - hide from all users unless they have View permission, or show to all users unless they have Hide permission.

It's up to you to create the permissions and assign them to roles.

Let me know if you have any problems or suggestions for improvements.

BTW - I am not sure how much use the Delete and View options really are in most situations, but they are there if you want them.

PS Thanks to @LostKobrakai for the code in this post: https://processwire.com/talk/topic/8836-how-to-manage-delete-tab-for-user-groups/?p=85340.

  • Like 23

Share this post


Link to post
Share on other sites

Please publish this new module.  Thanks and here's another useful tool you have developed.

  • Like 2

Share this post


Link to post
Share on other sites

Thank you! I want to encourage you to keep on going with those super usefull modules you always come up with. I do not vote for your modules every time I download them just to keep my ip from being banned.

  • Like 3

Share this post


Link to post
Share on other sites

I just posted an update to this.

I noticed a major issue when hiding the settings tab when you are using the "Name format for children" on a template (to bypass the initial page creation step).  

Note that this issue will affect all of the Settings hiding scripts that have been posted on the forums recently, as well as the advanced noSettings mode. I have posted an issue and possible solution on Github (https://github.com/ryancramerdesign/ProcessWire/issues/1048). The problem is that my core solution only handles the issue when the Settings tab is hidden via the noSettings option at the template level, not when hiding it other ways, hence the needed fix to this module.

The fix checks to see if template setting: “nameContentTab” is enabled which would add the name field to the content tab. If not, then we add a hidden version of the name field so that new pages will save without error.

 
This fix may no longer be necessary depending on the outcome of the Github issue - that is if Ryan can come up with a core solution for all scenarios.
  • Like 1

Share this post


Link to post
Share on other sites

I'll later take a look at it, but this could benefit of an inputfield selector. In my use cases I wouldn't hide these tabs for all pages.

  • Like 2

Share this post


Link to post
Share on other sites

Once I disabled settings tab in a project for some users. Very cool, to have this option as module now.
I played also around with disabling the whole tab rider 'Pages'. In some special cases this could be useful. Having a really frontend save backend is placed on the top of my personal PW wishlist. Enabling, disabling all tabs and subtabs according to permissions, roles and users. Restrictive sanitization and validation of all inputs. This together with a nice admin theme ....

You did one more step in this direction. Thanks.

  • Like 2

Share this post


Link to post
Share on other sites

How could I've missed this? Thanks ProcessWire Weekly #46 and of course adrian for again making a gem. These tools come in very handy.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks arjen - you didn't take long to find it, it was only put together and released on Friday :)

Glad you'll find it useful.

Looking for some feedback for those who might start using this. I am thinking of adding an option to add an UnPublish button to the Content tab when the Settings tab is hidden. I have also discussed the issue here: https://github.com/ryancramerdesign/ProcessWire/issues/1048#issuecomment-87449770

Kinda wondering if Ryan would be willing to add a core solution, but if not, I might add it to this module, because that is the one thing that I think users may still need. Most other things on the Settings tab are just noise for the average user, but Unpublish can be important.

What does everyone think?

Share this post


Link to post
Share on other sites

Ah, still I missed it adrian  :)

I would find it useful if we can adjust which fields can showed in the tabs. These days I'm running more and more into stuff clients don't really need. For me only name, hide, unpublish should be in settings. But it would be great if we can create or own lay-out. But than again, that's me and my clients  :rolleyes:  So I would find it useful if we can drag-and-drop our own Page Edit page.

Share this post


Link to post
Share on other sites

@arjen

There's always the option to remove certain fields with an own hooking module. It's just not as easy to set up. 

Share this post


Link to post
Share on other sites

I'll later take a look at it, but this could benefit of an inputfield selector. In my use cases I wouldn't hide these tabs for all pages.

I am curious if you're thinking on a page basis, or a template basis. I like the idea of adding this option, but I don't want to overcomplicate - it could turn out to be quite a matrix of options if you wanted certain pages/templates for some roles, but different ones for other roles. 

 

I would find it useful if we can adjust which fields can showed in the tabs. These days I'm running more and more into stuff clients don't really need. For me only name, hide, unpublish should be in settings. But it would be great if we can create or own lay-out. But than again, that's me and my clients  :rolleyes:  So I would find it useful if we can drag-and-drop our own Page Edit page.

I think this is quite do-able a might be a nice addition to this module. I think I'll add this functionality, but I would also like to have the option of adding an Unpublish button to the Content tab if the Settings tab is hidden because I am also in the same situation that in almost all cases, the Status section is the only part of Settings that I normally want most site editors to see, but rarely is Hidden necessary for them. It seems like an extra complication to have the Settings tab at all for many user roles, but of course the publication status sometimes still important.

  • Like 1

Share this post


Link to post
Share on other sites

I am curious if you're thinking on a page basis, or a template basis. I like the idea of adding this option, but I don't want to overcomplicate - it could turn out to be quite a matrix of options if you wanted certain pages/templates for some roles, but different ones for other roles. 

It does indeed sound like fulfilling this need would benefit from a completely different approach: instead of being able to globally state that "in order to see the Settings tab, your role has to have the tab-settings-view permission", this could mean creating multiple rulesets, each of which defines affected roles, uses a selector field to find pages, and allows selecting visible (or hidden, either way would work) tabs separately.

Sorry, just thinking out loud.. :)

  • Like 3

Share this post


Link to post
Share on other sites

@arjen

There's always the option to remove certain fields with an own hooking module. It's just not as easy to set up. 

That is indeed an option, but some kind of drag-and-drop solution would be great. The reason I didn't investigate it futher is because currently there is one Page Edit view and how do you manage a drag-and-drop solution? On a page basis or template basis? What if you make a small change and you have to change 24 other templates as well. I myself don't really see how to abstract those things or how to put an extra "layer" on top of the Page Edit screen.

I think this is quite do-able a might be a nice addition to this module. I think I'll add this functionality, but I would also like to have the option of adding an Unpublish button to the Content tab if the Settings tab is hidden because I am also in the same situation that in almost all cases, the Status section is the only part of Settings that I normally want most site editors to see and I rarely is Hidden necessary for them. It seems like an extra complication to have the Settings tab at all for many user roles, but of course the publication status is still important.

Thanks adrian! Do you have any idea how to order those fields (see my comment above)?

  • Like 1

Share this post


Link to post
Share on other sites

I'm on the same page as teppo. I'd much rather see something like a repeater where one selects roles (asm select), templates / pages and limits them with the checkboxes you're using. Maybe one could use a global permission which enables the role to be selectable and so that other devs can notice that this is managed by the module  and not by the traditional permission system. 

OT: Sound quite like the dynamic roles module. Never really used it and it's quite silent about it here in the forum.

  • Like 1

Share this post


Link to post
Share on other sites

Hi Adrian, found a little issue on line 111.

When the page has no title, a fatal error is thrown,

Never the less, thanks lot the module.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Martijn - not sure why I was using insertAfter there - just matching where it would be if it was visible, but since it's hidden it doesn't matter. I have committed a fix.

Also just so everyone knows, I will get to all your suggestions for making this more configurable - just waiting on Ryan's thoughts on some of those issues regarding a core fix or not.

  • Like 2

Share this post


Link to post
Share on other sites

Thx for this Adrian. Would it be able to work with custom tabs? 

  • Like 2

Share this post


Link to post
Share on other sites

Thx for this Adrian. Would it be able to work with custom tabs? 

Hey kongondo, thanks for the suggestion - already on my list of things to do :)

I would like to be able support Fieldset tabs as well as custom ones created via modules, like Nic's Page References Tab - I can see I am going to need more than one technique here :)

Was there any particular custom tab setup you were interested in being able to hide? Just good to get an idea of all the possible options.

Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

Nope, LanguageTabs are a different kind of animal. The fieldsets mentioned are WireTabs.

  • Like 1

Share this post


Link to post
Share on other sites

Hey kongondo, thanks for the suggestion - already on my list of things to do :)

I would like to be able support Fieldset tabs as well as custom ones created via modules, like Nic's Page References Tab - I can see I am going to need more than one technique here :)

Was there any particular custom tab setup you were interested in being able to hide? Just good to get an idea of all the possible options.

Thanks!

Nothing in particular....just WireTabs and yes, Fieldset tabs, ta...

Share this post


Link to post
Share on other sites

@arjen: why don't just hide them using custom css and admincustomfiles module?

Share this post


Link to post
Share on other sites

Does module differ superuser from non-superuser? When I hide Children, Settings and Delete tabs, they become hidden for all non-superusers (as expected). As for superuser - Children and Settings also become hidden, and Delete remains visible. I'd like superuser not be affected, e.g. all tabs should be visible. Is it a bug or feature?

PW 2.6.4 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Macrura
      Field Descriptions Extended
      This module enables you to extend field descriptions by dividing short descriptions with a longer text that is revealed in a toggle.
      Modules Directory: http://modules.processwire.com/modules/field-descriptions-extended/
      Github: https://github.com/outflux3/FieldDescriptionsExtended
      Extending your field descriptions using the standard field's description field.
      Once this module is installed, it will automatically search your description field for the presence of 5 dashes (-----).
      Any content above the 5 dashes will be visible and the content below the dashes will be hidden. A 'More...' link will appear at the end of the short description which when clicked will reveal the rest of the description.
      Using Simple Markdown Editor with the description field
      If you have Simple Markdown Editor (InputfieldSimpleMDE) installed, you can enable the field description to have that editor.
      *When using Simple MDE, you can use the button (Insert Horizontal Line) instead of typing 5 dashes. More about SimpleMDE.
      Extending your field descriptions using content from a ProcessWire Page for the field description.
      You may use the content from a ProcessWire page as a field description. This would allow you to easily insert images, links, and use hanna codes.
      To use page content for your field descriptions, please follow these instructions:
      Install Select Fields module (FieldtypeFields) http://modules.processwire.com/modules/fieldtype-fields/ Create a new field using this field type, e.g. field_select. Add the field to any template you will be using for your field descriptions. Setup your help pages (for example under a settings branch) where you will store the field description content,using the template containing the Field Select. Add content to a page and select the field where that content should show. To show a short text before the link to the longer content, separate them with 5 dashes Be sure to update your settings on this page, first enable page content descriptions,then specify the name of the Select Fields field, template to search, and content field. If you create a field description using this method, please note that the description field must be blank for contexts where you want the page content to appear.
      You can freely use template context for field descriptions, but the Page Content method is not context sensitive and will display under all contexts where the description is blank.
      ----
      original post:
      This is a new module, hope to release soon, which allows extended field descriptions, in currently 2 ways.
      The main feature of the module is that you can have a short description and then a 'more...' link which drops down a longer block of text.
      This is achieved by separating the intro/visible text and the rest with 5 dashes.

      Example setup:

      the 2nd way is if you are using AdminThemeUiKit, you can show extended field instructions in a panel. The content of the panel is edited on a regular PW page. This use case would probably not be that common, but if you had a field that required some extended instructions for how to use, this could be useful; Also, since this allows you to target information and instructions down at the field level, it could reduce the amount of documentation needed on a global level, since it is a lot more context targeted.

    • By Robin S
      Breadcrumb Dropdowns
      Adds dropdown menus of page edit links to the breadcrumbs in Page Edit.

      Installation
      Install the Breadcrumb Dropdowns module. The module requires ProcessWire >= v3.0.83 and AdminThemeUikit.
      There is a checkbox option in the module config that determines if the breadcrumb dropdowns will include pages that the user does not have permission to edit.
      Features/details
      The module adds an additional breadcrumb item at the end for the currently edited page. That's because I think it's more intuitive for the dropdown under each breadcrumb item to show the item's sibling pages rather than the item's child pages. In the dropdown menus the current page and the current page's parents are highlighted in a crimson colour to make it easier to quickly locate them in case you want to edit the next or previous sibling page. If the option to include uneditable pages is selected then those pages are indicated by a reduced text opacity and the "not-allowed" cursor is shown on hover. There is a limit of 25 sibling pages per dropdown for performance reasons and to avoid the dropdown becoming unwieldy. Incompatibilities
      This module replaces the AdminThemeUikit::renderBreadcrumbs method so will potentially be incompatible with other modules that hook the same method.
       
      https://modules.processwire.com/modules/breadcrumb-dropdowns/
      https://github.com/Toutouwai/BreadcrumbDropdowns
    • By joshuag
      Hey guys, 
      Thought I would share a quick preview of Designme. A module we (Eduardo @elabx and I) are building for visually laying out your templates/edit screens. 🙂
      This is a really quick, zero polish screen grab. FYI. 
      Video #2 - UPDATE
      This new video shows the following features in Designme:
      Re-arranging fields via Drag & Drop Re-sizing fields via Dragging. Adjusting field settings - with live refresh. Working on "hidden" fields while Designme is active. Creating New fields. Deleting fields. Creating/Deleting Tabs. Dragging fields between tabs. Creating fieldsets. Tagging/Un-tagging fields. Fields without headers expand when hovered (like checkboxes). Live filtering of fields in the sidebar. Ability to adjust (all) Template settings without leaving Designme. Template File Tree Editing Template files source code with ACE Editor. Editing Multiple files with ACE Editor. (New Tabs) Saving files. Techie stuff Fields load their own js/css dependancies. *ready to use on creation (*most fields)  Everything happens via Ajax to ProcessPageEdit (via module + hooks). Designme has a JS api that you can use.  All actions trigger events.  We would love any detailed feedback on what you see so far. If you are interested in testing Designme. Let me know below. 🙂
       
       
      Video #1. 
       
    • By dreerr
      TemplateEnginePug (formally TemplateEngineJade)
       
      This module adds Pug templates to the TemplateEngineFactory. It uses https://github.com/pug-php/pug to render templates.
      doctype html html(lang='en') head meta(http-equiv='content-type', content='text/html; charset=utf-8') title= $page->title link(rel='stylesheet', type='text/css', href=$config->urls->templates . 'styles/main.css') body include header.pug h1= $page->title if $page->editable() p: a(href=$page->editURL) Edit Project on GitHub: github.com/dreerr/TemplateEnginePug
      Project in modules directory: modules.processwire.com/modules/template-engine-pug/
       
      For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.
       
    • By tpr
      ProcessNetteTester
      Run Nette Tester tests within ProcessWire admin.
      (continued from here)

      Features
      AJAX interface for running Nette Tester tests, in bulk or manually display counter, error message and execution time in a table run all tests at once or launch single tests show formatted test error messages and report PHP syntax errors stop on first failed test (optional) hide passed tests (optional) display failed/total instead passed/total (optional) re-run failed tests only (optional) auto scroll (optional) include or exclude tests based on query parameters start/stop all tests with the spacebar reset one test or all tests (ctrl+click) https://modules.processwire.com/modules/process-nette-tester/
      https://github.com/rolandtoth/ProcessNetteTester