fix backend user access, fix payout cart account change

This commit is contained in:
Roland Schneider 2016-02-18 22:51:55 +01:00
parent 0ce6958e0b
commit 84e2badd34
14 changed files with 153 additions and 68 deletions

View File

@ -21,20 +21,26 @@ use common\components\Upload;
/**
* CardPackageController implements the CRUD actions for CardPackage model.
*/
class CardPackageController extends Controller {
public function behaviors() {
return [
'verbs' => [
'class' => VerbFilter::className (),
'actions' => [
'delete' => [
'post'
]
]
]
class CardPackageController extends \backend\controllers\BackendController {
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// allow authenticated users
[
'actions' => ['create','index','view','import','download'],
'allow' => true,
'roles' => ['admin','employee','reception'],
],
// everything else is denied
],
],
];
}
/**
* Lists all CardPackage models.
*

View File

@ -15,20 +15,27 @@ use backend\models\ContractRequestSearch;
/**
* ContractController implements the CRUD actions for Contract model.
*
* TODO: FIX CONTROLLER
*/
class ContractController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
public function behaviors() {
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// allow authenticated users
[
'actions' => [ ],
'allow' => true,
'roles' => ['admin','employee','reception'],
],
// everything else is denied
],
],
];
}
/**
* Lists all Contract models.

View File

@ -11,20 +11,28 @@ use yii\filters\VerbFilter;
/**
* DoorLogController implements the CRUD actions for DoorLog model.
*
* TODO: FIX ACCESS
*/
class DoorLogController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// allow authenticated users
[
'actions' => [ ],
'allow' => true,
'roles' => ['admin','employee','reception'],
],
// everything else is denied
],
],
];
}
/**
* Lists all DoorLog models.
@ -57,7 +65,6 @@ class DoorLogController extends Controller
* Creates a new DoorLog model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new DoorLog();
@ -70,13 +77,13 @@ class DoorLogController extends Controller
]);
}
}
*/
/**
* Updates an existing DoorLog model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
@ -89,19 +96,20 @@ class DoorLogController extends Controller
]);
}
}
*/
/**
* Deletes an existing DoorLog model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
*/
/**
* Finds the DoorLog model based on its primary key value.

View File

@ -27,7 +27,19 @@ class KeyController extends Controller {
'post'
]
]
]
] ,
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// allow authenticated users
[
'actions' => ['create','index','view','update'],
'allow' => true,
'roles' => ['admin','employee','reception'],
],
// everything else is denied
],
],
];
}

View File

@ -13,20 +13,28 @@ use common\components\DetStaDBSave;
/**
* MessageDetstaController implements the CRUD actions for MessageDetsta model.
*
* TODO : FIX ACCESS
*/
class MessageDetstaController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
public function behaviors()
{
return [
'access' => [
'class' => \yii\filters\AccessControl::className(),
'rules' => [
// allow authenticated users
[
'actions' => [ ],
'allow' => true,
'roles' => ['admin','employee','reception'],
],
// everything else is denied
],
],
];
}
/**
* Lists all MessageDetsta models.

View File

@ -15,6 +15,8 @@ use backend\models\GiroKotegForm;
/**
* TicketInstallmentRequestController implements the CRUD actions for TicketInstallmentRequest model.
*
* TODO: FIX ACCESS
*/
class TicketInstallmentRequestController extends Controller
{

View File

@ -61,6 +61,7 @@ class TransferController extends \backend\controllers\BackendController
'accounts' => $accounts,
'users' => $users,
]);
}
/**

View File

@ -14,6 +14,7 @@ use yii\web\UploadedFile;
/**
* UgiroController implements the CRUD actions for Ugiro model.
* TODO: FIX ACCESS
*/
class UgiroController extends Controller
{

View File

@ -69,12 +69,12 @@ class TransferSearch extends Transfer
$query = Transfer::find();
$query->innerJoinWith('account');
$query->innerJoin('user', " user.id = transfer.id_user");
if ( !RoleDefinition::isAdmin() ){
$query->innerJoin("user_account_assignment",'transfer.id_account = user_account_assignment.id_account' );
$query->andWhere(['user_account_assignment.id_user' => Yii::$app->user->id ]);
$query->andWhere(['account.type' => Account::TYPE_ALL ]);
if ( RoleDefinition::isReception()){
@ -84,6 +84,42 @@ class TransferSearch extends Transfer
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' =>[
'attributes' =>[
'paid_at' =>[
'asc' => ['transfer.paid_at' => SORT_ASC ],
'desc' => ['transfer.paid_at' => SORT_DESC],
],
'created_at' =>[
'asc' => ['transfer.created_at' => SORT_ASC ],
'desc' => ['transfer.created_at' => SORT_DESC],
],
'status' =>[
'asc' => ['transfer.status' => SORT_ASC ],
'desc' => ['transfer.status' => SORT_DESC],
],
'money' =>[
'asc' => ['transfer.money' => SORT_ASC ],
'desc' => ['transfer.money' => SORT_DESC],
],
'count' =>[
'asc' => ['transfer.count' => SORT_ASC ],
'desc' => ['transfer.count' => SORT_DESC],
],
'item_price' =>[
'asc' => ['transfer.item_price' => SORT_ASC ],
'desc' => ['transfer.item_price' => SORT_DESC],
],
'id_account' =>[
'asc' => ['account.name' => SORT_ASC ],
'desc' => ['account.name' => SORT_DESC],
],
'id_user' =>[
'asc' => ['user.username' => SORT_ASC ],
'desc' => ['user.username' => SORT_DESC],
],
]
]
]);

View File

@ -6,9 +6,7 @@ use common\models\Key;
/* @var $this yii\web\View */
/* @var $model common\models\Key */
$this->title = Yii::t('backend/key', 'Update {modelClass}: ', [
'modelClass' => 'Key',
]) . ' ' . $model->id_key;
$this->title = "Kulcs módosítása";
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/key', 'Keys'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_key, 'url' => ['view', 'id' => $model->id_key]];
$this->params['breadcrumbs'][] = Yii::t('backend/key', 'Update');

View File

@ -2,11 +2,13 @@
use yii\helpers\Html;
use yii\widgets\DetailView;
use common\models\Key;
use common\components\Helper;
/* @var $this yii\web\View */
/* @var $model common\models\Key */
$this->title = $model->id_key;
$this->title = "Kulcs részletek";
$this->params['breadcrumbs'][] = ['label' => Yii::t('backend/key', 'Keys'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
@ -16,25 +18,26 @@ $this->params['breadcrumbs'][] = $this->title;
<p>
<?= Html::a(Yii::t('backend/key', 'Update'), ['update', 'id' => $model->id_key], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('backend/key', 'Delete'), ['delete', 'id' => $model->id_key], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('backend/key', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_key',
[
'attribute' => 'id_key',
'label' =>"Kulcs azon."
],
'number',
'rfid_key',
'status',
'type',
'created_at',
'updated_at',
[
'attribute' => 'status',
'value' => Helper::getArrayValue( Key::statuses() ,$model->status, "Ismeretlen" )
],
[
'attribute' => 'type',
'value' => Helper::getArrayValue( Key::types() ,$model->type, "Ismeretlen" )
],
'created_at:datetime',
],
]) ?>

View File

@ -1,3 +1,6 @@
-0.0.37
- fix backend user acces
- fix sell product account will not anymore changed
-0.0.36
- Door log- add account
- Key import - no menu ( key/import )

View File

@ -4,7 +4,7 @@ return [
'supportEmail' => 'rocho02@gmail.com',
'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.36',
'version' => 'v0.0.37',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global

View File

@ -177,7 +177,7 @@ class ProductController extends Controller {
$connection = \Yii::$app->db;
$transaction = $connection->beginTransaction ();
try {
UserSoldItem::payout ( $user, $model->transfers , Account::readDefault() );
UserSoldItem::payout ( $user, $model->transfers );
$transaction->commit ();
\Yii::$app->session->setFlash ( 'success', 'Recepicó kosár fizetve' );
} catch ( Exception $e ) {