add backend theme AdminLte, bind reception/transaction to a permission

This commit is contained in:
2015-11-23 19:55:49 +01:00
parent e13866d7da
commit bcae71155e
25 changed files with 993 additions and 128 deletions

View File

@@ -95,8 +95,8 @@ class Account extends \yii\db\ActiveRecord
static function types() {
return [
self::TYPE_ALL => Yii::t('common/account', 'Visible for all'),
self::TYPE_VALUE_HIDDEN => Yii::t('common/account', 'Only the name is visible'),
self::TYPE_ALL => Yii::t('common/account', 'Account'),
// self::TYPE_VALUE_HIDDEN => Yii::t('common/account', 'Only the name is visible'),
];
}

View File

@@ -14,6 +14,8 @@ class LoginForm extends Model
public $rememberMe = true;
private $_user;
public $roles = null ;
/**
@@ -80,7 +82,21 @@ class LoginForm extends Model
if ($this->_user === null) {
$this->_user = User::findByUsername($this->username);
}
if ( $this->_user != null ){
if ( $this->roles != null ){
$canLogin = false;
foreach ($this->roles as $role){
$canLogin = $canLogin || Yii::$app->authManager->checkAccess($this->_user->id, $role);
}
if ( !$canLogin ){
\Yii::info("user ".$this->_user->username." has no permission to login to administration area!");
$this->_user = null;
}
}
}
return $this->_user;
}
}

View File

@@ -26,6 +26,8 @@ class User extends ActiveRecord implements IdentityInterface
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
const ROLE_RECEPTION = 'receptionist';
/**
* @inheritdoc