2017 © Pedro Peláez
 

symfony-bundle audit-bundle

Symfony 2 bundle for auditing

image

writtengames/audit-bundle

Symfony 2 bundle for auditing

  • Tuesday, June 12, 2018
  • by userfriendly
  • Repository
  • 3 Watchers
  • 4 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Cisco Systems AuditBundle

Build Status, (*1)

Symfony 2 bundle for auditing processes, employees, etc., (*2)

Features

This bundle offers the use of form (as in spreadsheet) for a user to audit a process and the management of these forms. Each form is divided in sections and fields and offers four choices of answer possible. Each of the elements can be modified at will through the administration part. (No user management is included in this bundle)., (*3)

In order to help you customize your template, the following twig extensions are available:, (*4)

twig functions:

    {{ get_resultforsection() }}        // return the score for the section
    {{ get_weightforsection() }}        // return the weight for the section
    {{ get_resultforaudit() }}          // return the result for the audit
    {{ get_weightforaudit() }}          // return the weight for the audit

twig filters:

    {{ element | archived ( parent ) }} // return the value of archived for the element and its parent element (section/form and field/section)
    {{ element | position ( parent ) }} // return the value of position for the element and its parent element (section/form and field/section)
    {{ form | sections( false|true ) }} // return the sections for the form archived === false | true
    {{ section | fields( false|true ) }}// return the fields for the section archived === false | true

~~Currently the forms are fairly static: Each Section is attached to one and only one Form and each Field is attached to one and only one Section.~~, (*5)

The above was correct in the previous iteration of the bundle. Currently, the schema has been changed to allow a Section to be assigned to more than one Form and similarily a Field can be assigned to more than one Section. Which means that the relationship between Form and Section, and between Section and Field are of Many to Many. However, in order to archive Sections, and Fields, the relationship itself has been materialized in a class that holds the property $archived., (*6)

PLEASE NOTE: the position of Sections on Form and Fields on Section is currently not working as the gedmo extension was to be used, but a change in the schema broke this., (*7)

Configuration

If audits are to be saved with a reference to the user having done the auditing the class of the User entity should be configured. Otherwise the user field will be set to NULL., (*8)

Likewise, if instead of a text input with the audit reference a dropdown menu with entities should be rendered, the class of the audited entity needs to be configured as well., (*9)

Also, a control user can be notified if an audit is considered as containing fatal errors., (*10)

Below is a complete example configuration (config.yml):, (*11)

cisco_audit:
    control_user: true
    user:
        class: Acme\UserBundle\Entity\User
        property: id
    audit_reference:
        class: Acme\ServiceBundle\Entity\ServiceCase
        property: caseId

Required

For now the following need to be added to the composer.json file of the project:, (*12)

    "repositories": [
        { "type": "vcs", "url": "http://github.com/WrittenGames/AuditBundle" }
    ]

    ...

    "require": {
        "cisco-systems/audit-bundle": "dev-master"
    }

Then update through composer.phar, (*13)

And add the bundle in the AppKernel:, (*14)

    $bundles = array(
        new Craue\TwigExtensionsBundle\CraueTwigExtensionsBundle(),
        new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
        new CiscoSystems\AuditBundle\CiscoSystemsAuditBundle(),
    );

Add as well the Bundle to the routing.yml:, (*15)

    CiscoSystemsAuditBundle:
        resource: "@CiscoSystemsAuditBundle/Resources/config/routing.yml"
        prefix:   /cisco_audit

Finally add the configuration for the stof bundle in the config.yml file:, (*16)

    # Doctrine Extensions
    stof_doctrine_extensions:
        orm:
            default:
                timestampable: true
                sluggable: true
                sortable: true

And the orm bundle for the user interface:, (*17)

    doctrine:
        orm:
            resolve_target_entities:
                CiscoSystems\AuditBundle\Model\UserInterface: Acme\UserBundle\Entity\User
                CiscoSystems\AuditBundle\Model\ReferenceInterface: Acme\UserBundle\Entity\Reference
                CiscoSystems\AuditBundle\Model\MetadataInterface: Acme\AuditBundle\Entity\Metadata

Once this all done, generate the tables needed:, (*18)

    php app/console doctrine:schema:update --dump-sql

Those are:, (*19)

  • audit__audit
  • audit__score
  • audit__element
  • audit__form
  • audit__section
  • audit__field
  • audit__relation
  • audit__form_section
  • audit__section_field

inheritance and doctrine

Please note that the class Element is abstract and Form, Section and Field are all children of that class. The same apply to the class Relation and its children: FormSection and SectionField., (*20)

Please note as well, that ManyToMany relationship exist between Form and Section, and Section and Field., (*21)

command

if you have saved (somehow) some audit with a totalscore of 0 (zero), you can regenerate those with the following command:, (*22)

    php app/console audit:score:regenerate
  • Option: 'id' as the audit id to process.
  • Option: '--override' to regenerate all the total score and not just the one with value of 0.

TODO

  • Allow a section to be assigned to more than one Form
  • Allow a Field to be assigned to more than one Section
  • Implement functional and unit testing
    • Entity done
    • maybe use [ICBaseTestBundle] (https://github.com/instaclick/ICBaseTestBundle)

Issues

Issues should be reported in [GitHub Issues] (https://github.com/WrittenGames/AuditBundle/issues), (*23)

License

This bundle is under the BSD license: The license can be read in [LICENSE] (https://github.com/WrittenGames/AuditBundle/blob/master/LICENSE)., (*24)

The Versions

12/06 2018

dev-CiscoUI

dev-CiscoUI

Symfony 2 bundle for auditing

  Sources   Download

BSD

The Requires

 

audit auditing audits

22/05 2018

dev-master

9999999-dev

Symfony 2 bundle for auditing

  Sources   Download

BSD

The Requires

 

audit auditing audits

18/04 2017

dev-default_weight_value

dev-default_weight_value

Symfony 2 bundle for auditing

  Sources   Download

BSD

The Requires

 

audit auditing audits

01/09 2016

3.1.x-dev

3.1.9999999.9999999-dev

Symfony 2 bundle for auditing

  Sources   Download

BSD

The Requires

 

audit auditing audits

17/08 2015

dev-choicetype

dev-choicetype

Symfony 2 bundle for auditing

  Sources   Download

BSD

The Requires

 

audit auditing audits