administrators management

This commit is contained in:
Etienne Roudeix
2013-10-23 16:31:37 +02:00
parent 3c69e38a3b
commit fb8b82093a
16 changed files with 1033 additions and 46 deletions

View File

@@ -0,0 +1,120 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event\Administrator;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Admin;
class AdministratorEvent extends ActionEvent
{
protected $administrator = null;
protected $id = null;
protected $firstname = null;
protected $lastname = null;
protected $login = null;
protected $password = null;
protected $profile = null;
public function __construct(Admin $administrator = null)
{
$this->administrator = $administrator;
}
public function hasAdministrator()
{
return ! is_null($this->administrator);
}
public function getAdministrator()
{
return $this->administrator;
}
public function setAdministrator(Admin $administrator)
{
$this->administrator = $administrator;
return $this;
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function setFirstname($firstname)
{
$this->firstname = $firstname;
}
public function getFirstname()
{
return $this->firstname;
}
public function setLastname($lastname)
{
$this->lastname = $lastname;
}
public function getLastname()
{
return $this->lastname;
}
public function setLogin($login)
{
$this->login = $login;
}
public function getLogin()
{
return $this->login;
}
public function setPassword($password)
{
$this->password = $password;
}
public function getPassword()
{
return $this->password;
}
public function setProfile($profile)
{
$this->profile = $profile;
}
public function getProfile()
{
return $this->profile;
}
}

View File

@@ -555,6 +555,12 @@ final class TheliaEvents
const PROFILE_RESOURCE_ACCESS_UPDATE = "action.updateProfileResourceAccess";
const PROFILE_MODULE_ACCESS_UPDATE = "action.updateProfileModuleAccess";
// -- Administrator management ---------------------------------------------
const ADMINISTRATOR_CREATE = "action.createAdministrator";
const ADMINISTRATOR_UPDATE = "action.updateAdministrator";
const ADMINISTRATOR_DELETE = "action.deleteAdministrator";
// -- Tax Rules management ---------------------------------------------
const TAX_RULE_CREATE = "action.createTaxRule";

View File

@@ -37,16 +37,16 @@ final class AdminResources
static public function retrieve($name)
{
$contantName = strtoupper($name);
$constantName = strtoupper($name);
if(null === self::$selfReflection) {
self::$selfReflection = new \ReflectionClass(__CLASS__);
}
if(self::$selfReflection->hasConstant($contantName)) {
return self::$selfReflection->getConstant($contantName);
if(self::$selfReflection->hasConstant($constantName)) {
return self::$selfReflection->getConstant($constantName);
} else {
throw new ResourceException(sprintf('Resource `%s` not found', $contantName), ResourceException::RESOURCE_NOT_FOUND);
throw new ResourceException(sprintf('Resource `%s` not found', $constantName), ResourceException::RESOURCE_NOT_FOUND);
}
}
@@ -54,7 +54,7 @@ final class AdminResources
const ADDRESS = "admin.address";
const ADMIN = "admin.configuration.admin";
const ADMINISTRATOR = "admin.configuration.administrator";
const AREA = "admin.configuration.area";