group training: add admin menu improvements, add build environment files

This commit is contained in:
Roland Schneider
2021-09-26 11:45:01 +02:00
parent c2ea538103
commit 0b5ea5df09
10 changed files with 165 additions and 40 deletions

View File

@@ -4,17 +4,18 @@ namespace common\components;
use \Yii;
class RoleDefinition{
public static function roleLabels(){
return [
'reception' => Yii::t('common/role' ,'Reception'),
'admin' => Yii::t('common/role' ,'Administrator'),
'employee' => Yii::t('common/role' ,'Employee'),
'Trainer' => Yii::t('common/role' ,'Edző'),
];
}
public static function getRoleLabel($role){
$result = null;
$roleLabels = self::roleLabels();
@@ -23,8 +24,8 @@ class RoleDefinition{
}
return $result;
}
public static function roleDefinitions(){
return [
'employee' => [
@@ -38,8 +39,8 @@ class RoleDefinition{
],
];
}
public static function getRoleDefinition($role){
$defs = self::roleDefinitions();
$result = null;
@@ -49,14 +50,14 @@ class RoleDefinition{
$result = $defs[$role];
return $result;
}
public static function getRolesCanAllow($role){
$result = [];
$def = self::getRoleDefinition($role);
if ( isset($def)){
$result = $def['canAllow'];
}
return $result;
}
@@ -75,11 +76,11 @@ class RoleDefinition{
}
return $result;
}
public static function isAdmin(){
return self::can('admin');
}
public static function isReception(){
return self::can('reception');
}
@@ -87,7 +88,16 @@ class RoleDefinition{
public static function isEmployee(){
return self::can('employee');
}
public static function isTrainer(){
return self::can('trainer');
}
public static function isLoggedUser(){
return self::isTrainer() || self::isAdmin() || self::isEmployee()
|| self::isReception();
}
/*
* [
* 'role1' => 'template1',
@@ -104,5 +114,5 @@ class RoleDefinition{
}
return $result;
}
}
}