2017 © Pedro Peláez
 

tao-extension extension-tao-dac-simple

extension that allows admin to give access to some resources to other people

image

oat-sa/extension-tao-dac-simple

extension that allows admin to give access to some resources to other people

  • Friday, July 27, 2018
  • by oat-lionel
  • Repository
  • 22 Watchers
  • 2 Stars
  • 20,664 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 40 Versions
  • 7 % Grown

The README.md

Simple Data Access Control

codecov, (*1)

Simple Data Access Control allows the restriction of which user can access which resources, in the way compatible with Advanced Search., (*2)

Access Privileges are granted either to users directly or to roles, applying to all users who have that specific role., (*3)

Privileges are given per resource, so that in order to remove the write access to all items within a class, the new access rights need to be applied recursively to all resources by checking "recursive" before saving the changes., (*4)

Privileges are additive, meaning that if:, (*5)

  • Role A has write and read access to Item 1
  • User X has read access to Item 1
  • And User X has the Role A

Then User X he will have read and write access to Item 1, (*6)

How to enable ACL management

In order to see the Access control button on the backoffice panel a few changes are necessary., (*7)

Enable this in the actions

Change the actions/structures.xml file by adding the attribute allowClassActions="true" in the actions node:, (*8)

<?xml version="1.0" encoding="utf-8"?>
<structures>
    <structure>
        <sections>
            <section>
                <trees><!-- Something here --></trees>
                <actions allowClassActions="true">
                    <action><!-- Something here --></action>
                </actions>
            </section>
        </sections>
    </structure>
</structures>

Enable ACL in an endpoint

Add the annotation requiresRight with proper field and grant level to check permissions:, (*9)

class MyController extends tao_actions_SaSModule
{
    /**
     * @requiresRight id READ
     */
    public function editInstance()
    {
      //...
    }
}

Checking ACL internally (without annotations) in the endpoint

If extending tao_actions_RdfController we can use the method hasWriteAccess:, (*10)

class MyController extends tao_actions_SaSModule
{
    public function editItem()
    {
        $item = $this->getCurrentInstance();

        if ($this->hasWriteAccess($item->getUri())) {
            // Do something
        }
    }
}

Or we can use the DataAccessControl implementation directly:, (*11)

$user = $this->getSession()->getUser();
$item = $this->getCurrentInstance();
$dataAccessControl = new \oat\tao\model\accessControl\data\DataAccessControl();

$canWrite = $dataAccessControl->hasPrivileges($user, [$item->getUri() => 'WRITE']);
$canRead = $dataAccessControl->hasPrivileges($user, [$item->getUri() => 'READ']);

Permissions save strategies

Currently, we have the following saving/propagating permissions strategies:, (*12)

IMPORTANT: Saving with recursive option is very dangerous, cause will override permissions for all subclasses and resources., (*13)

The permission strategy is configured here config/taoDacSimple/PermissionsService.conf.php. Example:, (*14)

<?php
return new oat\taoDacSimple\model\PermissionsServiceFactory(
    [
        'save_strategy' => 'oat\\taoDacSimple\\model\\SyncPermissionsStrategy',
        'recursive_by_default' => false
    ]
);

Environment variables

Variable Description Default value Values
ACL_TRANSFER_MODE Set the preferable transfer mode acl.use.destination acl.use.destinationbr/ acl.keep.original

The Versions

27/07 2018

dev-master

9999999-dev http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0 GPL-2.0-only

The Requires

 

tao computer-based-assessment

27/07 2018

dev-develop

dev-develop http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0 GPL-2.0-only

The Requires

 

tao computer-based-assessment

27/07 2018

v2.7.1

2.7.1.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

27/07 2018

dev-release-2.7.1

dev-release-2.7.1 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

27/07 2018

dev-TAO-6542_bump_version

dev-TAO-6542_bump_version http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

04/05 2018

v2.7.0

2.7.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

04/05 2018

dev-release-2.7.0

dev-release-2.7.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

25/04 2018

dev-TAO-6161_dac_administrator_role

dev-TAO-6161_dac_administrator_role http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

24/04 2018

dev-TAO-6161_prevent_lock_out_current_user

dev-TAO-6161_prevent_lock_out_current_user http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

26/01 2018

v2.5.1

2.5.1.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

24/01 2018

v2.5.0

2.5.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0-only

The Requires

 

tao computer-based-assessment

12/01 2018

v2.4.0

2.4.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

21/12 2017

v2.3.0

2.3.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

21/12 2017

dev-release-2.3.0

dev-release-2.3.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

10/11 2017

v2.2.0

2.2.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

10/11 2017

dev-release-2.2.0

dev-release-2.2.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

13/10 2017

v2.1.0

2.1.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

06/10 2017

dev-refactoring/TAO-5104/remove-globals-from-generis

dev-refactoring/TAO-5104/remove-globals-from-generis http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

29/09 2017

dev-TAO-5207/configurable_persistance

dev-TAO-5207/configurable_persistance http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

18/09 2017

dev-refactoring/TAO-5105/remove_globals_from_tao_core

dev-refactoring/TAO-5105/remove_globals_from_tao_core http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

20/07 2017

v2.0.3

2.0.3.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

12/05 2017

v2.0.1

2.0.1.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

28/04 2017

v2.0.0

2.0.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

15/07 2016

v1.5.0

1.5.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

06/06 2016

v1.4.0

1.4.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

11/05 2016

v1.3.1

1.3.1.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

25/04 2016

v1.3.0

1.3.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

13/04 2016

dev-fix/action-serialisation

dev-fix/action-serialisation http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

11/04 2016

v1.2.2

1.2.2.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

29/12 2015

v1.2.1

1.2.1.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

25/09 2015

dev-mpdeploy

dev-mpdeploy http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

26/08 2015

dev-dev-act

dev-dev-act http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

19/08 2015

v1.2.0

1.2.0.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

19/06 2015

v1.0.2

1.0.2.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

08/06 2015

dev-translate

dev-translate http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

30/04 2015

v1.0.1

1.0.1.0 http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

06/11 2014

1.0.1-beta

1.0.1.0-beta http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

22/10 2014

dev-read-write

dev-read-write http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

21/10 2014

dev-OAT-55-migrate

dev-OAT-55-migrate http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment

22/09 2014

dev-quality

dev-quality http://www.taotesting.com

extension that allows admin to give access to some resources to other people

  Sources   Download

GPL-2.0

The Requires

 

tao computer-based-assessment