Skip to content

Commit

Permalink
Merge branch 'feature/admin-roles' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
cbleek committed May 11, 2015
2 parents 745f7c9 + 8623d74 commit ee76249
Show file tree
Hide file tree
Showing 18 changed files with 699 additions and 6 deletions.
3 changes: 2 additions & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
'Settings',
'Pdf',
'Geo',
'Organizations'
'Organizations',
'Admin'
);

if (!isset($allModules)) {
Expand Down
1 change: 1 addition & 0 deletions module/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# and "Settings"

!.gitignore
!Admin
!Applications
!Auth
!Core
Expand Down
4 changes: 4 additions & 0 deletions module/Admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
!*
*~
build.properties

66 changes: 66 additions & 0 deletions module/Admin/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* YAWIK
* Auth Module Bootstrap
*
* @copyright (c) 2013-2014 Cross Solution (http://cross-solution.de)
* @license MIT
*/

namespace Admin;

use Zend\ModuleManager\Feature;
use Zend\Loader\StandardAutoloader;

/**
* Bootstrap class of the Admin module
*
*/
/**
* Bootstrap class of the Admin Module
*/
class Module implements Feature\DependencyIndicatorInterface,
Feature\AutoloaderProviderInterface,
Feature\ConfigProviderInterface
{
public function getModuleDependencies()
{
return array('Core','Auth');
}

/**
* indicates, that the autoload configuration for this module should be loaded.
* @see
*
* @var bool
*/
public static $isLoaded=false;


function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

/**
* Loads module specific autoloader configuration.
*
* @return array
*/
public function getAutoloaderConfig()
{
return array(
StandardAutoloader::class => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
__NAMESPACE__ . 'Test' => __DIR__ . '/test/' . __NAMESPACE__ . 'Test',
),
),
);
}

function onBootstrap()
{
self::$isLoaded=true;
}
}
165 changes: 165 additions & 0 deletions module/Admin/config/module.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<?php
/**
* YAWIK
* Configuration file of the Auth module
*
* @copyright (c) 2013-2014 Cross Solution (http://cross-solution.de)
* @license MIT
*/

return array(
/*
* Acl definitions.
* Format
* array($ROLE[:$PARENT] => $RESOURCES);
*
* $ROLE: Role name
* $PARENT: Coma separated list of roles to inherit from.
* $RESOURCES: array of resources
* a resource is
* 1. a string: taken as resource name
* (when prefixed with "!", a deny rule is created.)
* 1.1 the "null" value: allow on all resources.
* 2. a key => string pair:
* key is the resource name (optionally prefixed with "!")
* if key is "__ALL__" rule apply to all resources.
* string is the privilege name
* 3. a key => array pair:
* key is the resource name (optionally prefixed with "!")
* array are the privileges which each of is
* 1. a string: Taken as privilege name
* 2. a key => string pair:
* key is the privilege name
* string is the name of the assertion class to instantiate and use with this rule.
* 3. a key => array pair:
* key is the privilege name
* array is:
* index 0: Name of the assertion class,
* index 1: array of parameters to pass to the constructor of the assertion.
*
*/
'acl' => array(
'roles' => array(
'admin' => 'recruiter'
),

'public_roles' => array(
/*@translate*/ 'admin',
),
'rules' => array(
'admin' => array(
'allow' => array(
'route/lang/admin',
'route/lang/my',
'/logout',
'route/lang/jobs/edit'
),
'deny' => array(
'route/lang/auth',
'route/auth-provider',
'route/auth-hauth',
'route/auth-extern',
),
),
'user' => array(
'deny' => array(
'route/lang/admin',
),
),
'recruiter' => array(
'deny' => array(
'route/lang/admin'
),
),
),
),
// Adds the Admin Link to the navigation
'navigation' => array(
'default' => array(
'admin' => array(
'label' => 'Admin',
'route' => 'lang/admin',
'order' => 1000,
'resource' => 'route/lang/admin',

'pages' => array(
'list' => array(
'label' => /*@translate*/ 'Global Settings',
'route' => 'lang/admin',
'params' => array(
'section' => 'global-settings'
),
),
'hybridauth' => array(
'label' => /*@translate*/ 'Social Networks',
'route' => 'lang/admin',
'params' => array(
'section' => 'hybrid-auth'
),
),
'modules' => array(
'label' => /*@translate*/ 'Modules',
'route' => 'lang/admin',
'params' => array(
'section' => 'modules'
),
),
'static' =>array(
'label' => /*@translate*/ 'Static Pages',
'route' => 'lang/admin',
'params' => array(
'section' => 'static-pages'
),
),
'email' =>array(
'label' => /*@translate*/ 'Mail Settings',
'route' => 'lang/admin',
'params' => array(
'section' => 'mail-settings'
),
),
),
),
),
),

'translator' => array(
'translation_file_patterns' => array(
array(
'type' => 'gettext',
'base_dir' => __DIR__ . '/../language',
'pattern' => '%s.mo',
),
),
),
'router' => array('routes' =>
array('lang' =>
array('child_routes' =>
array(
'admin' => array(
'type' => 'Segment',
'options' => array(
'route' => '/admin[/:section]',
'defaults' => array(
'controller' => 'Admin\Config',
'action' => 'index',
'section' => 'global-settings'
),
),
'may_terminate' => true,
),
),
),
),
),
'controllers' => array(
'invokables' => array(
'Admin/Config' => 'Admin\Controller\ConfigController',
),
),
'view_manager' => array(
'template_path_stack' => array(
'Admin' => __DIR__ . '/../view',
),
),
);
34 changes: 34 additions & 0 deletions module/Admin/src/Admin/Controller/ConfigController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* YAWIK
*
* @filesource
* @copyright (c) 2013-2014 Cross Solution (http://cross-solution.de)
* @license MIT
*/

/** IndexController of the Admin Module */
namespace Admin\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;


/**
* The Index Controller contains actions for handling static content.
*
*/
class ConfigController extends AbstractActionController
{
public function indexAction()
{
$viewModel = new ViewModel();
$viewModel->setTemplate('admin/config/'. $this->params()->fromRoute('section'));

$services = $this->getServiceLocator();
$container = $services->get('forms')->get('Admin\Form\Config');

$viewModel->setVariable('form' , $container);
return $viewModel;
}
}
68 changes: 68 additions & 0 deletions module/Admin/src/Admin/Entity/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* YAWIK
*
* @copyright (c) 2013-2014 Cross Solution (http://cross-solution.de)
* @license GPLv3
*/

namespace Admin\Entity;

use Core\Entity\AbstractIdentifiableModificationDateAwareEntity as BaseEntity;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Core\Repository\DoctrineMongoODM\Annotation as Cam;


/**
* The global Configuration.
*
* @ODM\Document(collection="Configuration", repositoryClass="Admin\Repository\Configuration")
*/
class Config extends BaseEntity {

const postConstruct = 'postRepositoryConstruct';

protected $name;

protected $value;

/**
* Sets the name of the organization
*
* @param string $name
* @return ConfigInterface
*/
public function setName($name){
$this->name=$name;
}

/**
* Gets the name of the configuration parameter
*
* @return string $name
*/
public function getName() {
return $this->name;
}


/**
* @return string
*/
public function getValue(){
return $this->value;
}

/**
* @param string $description
* @return ConfigInterface
*/
public function setValue($value){
$this->value=$value;
}



}


Loading

0 comments on commit ee76249

Please sign in to comment.