Skip to content

Commit

Permalink
Updated auth manager and AR
Browse files Browse the repository at this point in the history
  • Loading branch information
itsCracker committed Dec 15, 2021
1 parent 0d5e63d commit 3976aff
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions add
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
git init
git remote add origin https://github.com/vaultke/foundation.git
git add --all
git commit -m "adjusted authenticator"
git commit -m "Updated auth manager and AR"
git branch -M master
git tag -a v1.0.36 -m "Audit trail fix"
git tag -a v1.0.37 -m "AR & DB Manager fix"
git push -u origin master
git push --tags
12 changes: 11 additions & 1 deletion src/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@
namespace vaultke\foundation;

use yii\behaviors\TimestampBehavior;
use yii\behaviors\AttributeBehavior;
use vaultke\foundation\behaviors\Delete;
class ActiveRecord extends \yii\db\ActiveRecord
{
public function behaviors()
{
return [
TimestampBehavior::className(),
Delete::className(),
\vaultke\foundation\behaviors\Delete::className(),
\vaultke\foundation\behaviors\AuditTrail::className(),
[
'class' => AttributeBehavior::class,
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => static::cryptKey().'_crypt_id',
],
'value' => function ($event) {
return hash_hmac('sha256', md5(date('DYM').substr(str_shuffle("0123456789abcdefghijklmnopqrstvwxyz"), 0, 10)), sha1(date('myd').rand(0,9999999999)));
},
],
];
}

Expand Down
16 changes: 16 additions & 0 deletions src/auth/AuthManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@
use Yii;
class AuthManager extends \yii\rbac\DbManager
{
/**
* @var string the name of the table storing authorization items. Defaults to "auth_item".
*/
public $itemTable = '{{%item}}';
/**
* @var string the name of the table storing authorization item hierarchy. Defaults to "item_child".
*/
public $itemChildTable = '{{%item_child}}';
/**
* @var string the name of the table storing authorization item assignments. Defaults to "assignment".
*/
public $assignmentTable = '{{%assignment}}';
/**
* @var string the name of the table storing rules. Defaults to "rule".
*/
public $ruleTable = '{{%rule}}';
use AuthJwt;
protected $checkAccessAssignments = [];

Expand Down

0 comments on commit 3976aff

Please sign in to comment.