2017 © Pedro Peláez
 

symfony-bundle kalinka-bundle

Flexible authorization for your Symfony2 app

image

ac/kalinka-bundle

Flexible authorization for your Symfony2 app

  • Wednesday, April 2, 2014
  • by dsimon
  • Repository
  • 5 Watchers
  • 2 Stars
  • 218 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 7 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Kalinka-Bundle

Build Status, (*1)

Symfony2 bundle for Kalinka., (*2)

Installation

  1. require "ac/kalinka-bundle": "~0.1.0" in yourcomposer.json`
  2. run composer update ac/kalinka
  3. Instantiate AC\KalinkaBundle\ACKalinkaBundle in your AppKernel
  4. Configure the bundle, described below:

Configuration

ac_kalinka:
    #default_authorizer: 'default'
    authorizers:
        default:
            authenticated_role: 'authenticated'     #optional
            anonymous_role: 'anonymous'             #optional
            roles:                                  #map roles to actions and guard policies
                authenticated:
                    document:
                        read: 'allow'
                        index: 'allow'
                anonymous:
                    document:
                        read: 'allow'
                teacher:
                    system:
                        foo: 'allow'
                    document:
                        index: 'allow'
                        create: 'allow'
                        read: 'allow'
                        update: ['owner', 'unlocked']
                        delete: ['owner', 'unlocked']
                admin:
                    system:
                        foo: 'allow'
                        bar: 'allow'
                        baz: 'allow'
                    document:
                        index: 'allow'
                        create: 'allow'
                        read: 'allow'
                        update: 'allow'
                        delete: 'allow'
                student:
                    document:
                        index: 'allow'
                        read: 'allow'

Services

The bundle registers the kalinka.authorizer service, which you can use in your app:, (*3)

$document = //...get some document instance, however you do that

$authorizer = $this->container->get('kalinka.authorizer');

if (!$authorizer->can('edit', 'document', $someDocument)) {
    throw new Exception('Computer says no. :(');
}

To register guards just use the kalinka.guard tag, and specify the domain of the guard. For example:, (*4)

services:
    app.guard.document:
        class: ACME\AppBundle\Authorization\DocumentGuard
        tags:
            - { name: 'kalinka.guard', tag: 'document' }

You can also configure multiple authorizers if you need them., (*5)

#TODO: document said feature

The Versions

02/04 2014

dev-master

9999999-dev

Flexible authorization for your Symfony2 app

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Simon

authorization auth kalinka

02/04 2014

0.1.2

0.1.2.0

Flexible authorization for your Symfony2 app

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Simon

authorization auth kalinka

05/03 2014

0.1.1

0.1.1.0

Flexible authorization for your Symfony2 app

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Simon

authorization auth kalinka

28/01 2014

0.1.0

0.1.0.0

Flexible authorization for your Symfony2 app

  Sources   Download

MIT

The Requires

 

The Development Requires

by David Simon

authorization auth kalinka