Coder Social home page Coder Social logo

helpfulrobot / titledk-silverstripe-memberpages Goto Github PK

View Code? Open in Web Editor NEW

This project forked from titledk/silverstripe-memberpages

0.0 2.0 0.0 27 KB

Programmatically make your pages accessible only to members and/or cetain member groups

License: MIT License

PHP 100.00%

titledk-silverstripe-memberpages's Introduction

SilverStripe Memberpages

Programmatically make your pages accessible only to members and/or cetain member groups

This module helps you when working with page types that should be restricted from members that have not been logged in, and/or restricted to a certain group.
While that behavior can easily be achieved via the CMS, sometimes you just want this to be the default, and not changeable by any users of the CMS.
This could especially be the case for sites with several languages, where the Sitetree can easily get cluttered up, but also just to keep things streamlined while working on a project with several developers, test servers etc.

Beyond that, we just sometimes like it better to define page permissions via code.

Features

  • Pages extending MembersOnlyPage are only accessible by members
  • Modules like blogs, forums etc can be extended with the MembersOnlyPageExtension
  • Per default a page is shown to all logged in members. You can change that default by setting the $dictatedViewerGroups array in your page

Usage

Either extend MembersOnlyPage, or (if that's not possible), use the MembersOnlyPageExtension.

In order to only allow certain groups, add the following to your page:

public $dictatedViewerGroups = array(
	'allowedgroupcode1',
	'allowedgroupcode2'
);

Example

In the frontend you'll only notice that pages are only available to the members you define, in the backend you'll notice that the section where you can change permissions is no longer editable by the user, and instead looks something like this:

memberpages admin example

titledk-silverstripe-memberpages's People

Contributors

anselmdk avatar

Watchers

James Cloos avatar helpfulrobot avatar

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.