2017 © Pedro Peláez
 

silverstripe-module silverstripe-manageable-dataobject

Allows frontend DataObject management

image

dynamic/silverstripe-manageable-dataobject

Allows frontend DataObject management

  • Thursday, December 21, 2017
  • by dynamic
  • Repository
  • 5 Watchers
  • 2 Stars
  • 1,554 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

dynamic/silverstripe-manageable-dataobject

Build Status Scrutinizer Code Quality codecov, (*1)

Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads, (*2)

Allow front-end management of DataObjects., (*3)

Requirements

  • SilverStripe ^4.0
  • Viewable Dataobject ^2.0
  • Additional Form Fields ^2.0

Installation

composer require dynamic/silverstripe-manageable-dataobject, (*4)

Configuration

MyPageController:
  managed_object: MyManageableObject
  extensions:
    - Dynamic\ManageableDataObject\Extensions\ManageableControllerExtension

MyManageableObject:
  extensions:
    - Dynamic\ViewableDataObject\Extensions\ViewableDataObject
    - Dynamic\ManageableDataObject\Extensions\ManageableObjectExtension
  listing_page_class: MyPage

MyManageableObject

To utilize ManageableDataObject you must implement PermissionProvider and methods defined in ManageableDataObjectInterface. The example below is a very basic implementation of the PermissionProvider and ManageableDataObjectInterface methods., (*5)

<?php

namespace Foo\Bar;

use Dynamic\ManageableDataObject\Interfaces\ManageableDataObjectInterface;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\RequiredFields;
use SilverStripe\ORM\DataObject;
use SilverStripe\Security\Permission;
use SilverStripe\Security\PermissionProvider;

class MyManageableObject extends DataObject implements PermissionProvider, ManageableDataObjectInterface
{

        /**
     * @return array
     */
    public function providePermissions()
    {
        return [
            'MDO_Create',
            'MDO_Edit',
            'MDO_Delete',
            'MDO_View',
        ];
    }

    /**
     * @param null $member
     * @param array $context
     *
     * @return bool|int
     */
    public function canCreate($member = null, $context = array())
    {
        return Permission::check('MDO_Create', 'any', $member);
    }

    /**
     * @param null $member
     *
     * @return bool|int
     */
    public function canEdit($member = null)
    {
        return Permission::check('MDO_Edit', 'any', $member);
    }

    /**
     * @param null $member
     *
     * @return bool|int
     */
    public function canDelete($member = null)
    {
        return Permission::check('MDO_Delete', 'any', $member);
    }

    /**
     * @param null $member
     *
     * @return bool|int
     */
    public function canView($member = null)
    {
        return Permission::check('MDO_View', 'any', $member);
    }

    /**
     * @param null $params
     *
     * @return FieldList
     */
    public function getFrontEndFields($params = null)
    {
        return parent::getFrontEndFields();
    }

    /**
     * @return FieldList
     */
    public function getFrontEndActions()
    {
        return FieldList::create();
    }

    /**
     * @return RequiredFields
     */
    public function getFrontEndRequiredFields()
    {
        return RequiredFields::create();
    }
}

The Versions

21/12 2017

dev-master

9999999-dev

Allows frontend DataObject management

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe

24/07 2017

1.0.0-alpha1

1.0.0.0-alpha1

Allows frontend DataObject management

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

silverstripe