Skip to content

Commit

Permalink
Merge pull request #37 from dmstr/feature/access_owner_uuid
Browse files Browse the repository at this point in the history
allow string(255) for access_owner as in other access_ cols
  • Loading branch information
eluhr authored Jul 24, 2023
2 parents de3230d + 1415edb commit 75f2408
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class Module extends \yii\base\Module
* @var array
*/
public $defaultPermissions = [
self::ACCESS_OWNER => 1,
self::ACCESS_OWNER => '1',
self::ACCESS_READ => '*',
self::ACCESS_UPDATE => '*',
self::ACCESS_DELETE => '*',
Expand Down
17 changes: 17 additions & 0 deletions migrations/m230606_120101_change_hashmap_table_access_owner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

use yii\db\Migration;

class m230606_120101_change_hashmap_table_access_owner extends Migration
{
public function up()
{
// allow uuid as access_owner value
$this->alterColumn("filefly_hashmap","access_owner", $this->string(36));
}

public function down()
{
return false;
}
}
17 changes: 17 additions & 0 deletions migrations/m230606_120120_change_hashmap_table_access_owner_v2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

use yii\db\Migration;

class m230606_120120_change_hashmap_table_access_owner_v2 extends Migration
{
public function up()
{
// allow uuid and longer strings as access_owner value
$this->alterColumn("filefly_hashmap","access_owner", $this->string(255));
}

public function down()
{
return false;
}
}
6 changes: 4 additions & 2 deletions models/base/FileflyHashmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @property string $type
* @property string $path
* @property integer $size
* @property integer $access_owner
* @property string $access_owner
* @property string $access_read
* @property string $access_update
* @property string $access_delete
Expand Down Expand Up @@ -46,10 +46,12 @@ public function rules()
{
return [
[['component', 'path'], 'required'],
[['access_owner', 'size'], 'integer'],
[['size'], 'integer'],
[['created_at', 'updated_at'], 'safe'],
[['component'], 'string', 'max' => 45],
[['type'], 'string', 'max' => 32],
// we want to allow int ids and (uuid) strings, so we do not check strict string type here
[['access_owner'], 'string', 'max' => 255, 'strict' => false],
[['access_read', 'access_update', 'access_delete', 'path'], 'string', 'max' => 255],
[
['component', 'path', 'access_owner'],
Expand Down

0 comments on commit 75f2408

Please sign in to comment.