Giter Club home page Giter Club logo

pageprotector's Introduction

Page Protector

Processwire module to allow site editors to protect pages from guest access.

Functionality

  • Ability for your site editors to control the user access to pages directly from Settings tab of each page
  • Include whether to protect all children of this page or not
  • Optionally allow access to only specified roles
  • Option to protect all hidden pages (and optionally their children)
  • Ability to change the message on the login page to make it specific to this page
  • Option to have login form and prohibited message injected into a custom template
  • Access to the "Protect this Page" settings panel is controlled by the "page-edit-protected" permission
  • Table in the module config settings that lists the details all of the protected pages
  • Shortcut to protect entire site with one click

API method

You can make changes to the protection settings of a page via the API

// all optional, except "page_protected", which must be set to true/false
// if setting it to false, the other options are not relevant

$options = array(
    "page_protected" => true,
    "children_protected" => true,
    "roles" => array("role1", "role2"),
    "message_override" => "My custom login message",
    "prohibited_message" => "My custom prohibited access message"
);

$page->protect($options);

You can also check the status of a page with:

$page->protected
$page->prohibited

Support forum:

https://processwire.com/talk/topic/8387-page-protector/

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

(See included LICENSE file for full license text.)

pageprotector's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pageprotector's Issues

Message text not editable

Changes to the text inside the Message field (Admin > Modules > Page Protector) has no effect to the login screen (PW 2.8.23).

Redirects to parent page

Hi there,

I was testing this module and noticed a problem. If I protect the page /about/what to the role "bloggers" and login to that protected page with a logged out user that contains the role "blogger" , it will show the login form correctly, but after logging into that form it will redirect me to the parent page /about.

If I visit /about/what as a logged in user that contains the role "blogger", it will correctly show me the page with edit rights.

I hope that is clear. Let me know if I can clarify more. I tried protecting two different pages and it did the same thing on each page.

I'm running PW 3.0.37 on mac with php 5.6 and Apache 2.4.

Error in PHP 8: Unparenthesized `a ? b : c ? d : e` is not supported

I have this module in a non-enabled/non-installed state on a site that I recently upgraded to PHP 8, and I got this error in PW's error log (the site 500's):

2021-01-01 22:45:07	guest	https://website.com/	Compile Error:  Unparenthesized `a ? b : c ? d : e` is not supported. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` (line 389 of /var/www/website.com/public_html/site/assets/cache/FileCompiler/site/modules/PageProtector/PageProtector.module.php)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.