Skip to content

Commit bc25f3c

Browse files
committed
Move acl_allowed to AccessControl extended class
1 parent 7734fa2 commit bc25f3c

File tree

18 files changed

+38
-49
lines changed

18 files changed

+38
-49
lines changed

src/Models/Comment/Create.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,20 @@
22

33
namespace BNETDocs\Models\Comment;
44

5-
class Create extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class Create extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
77
public const ERROR_ACL_NOT_SET = 'ACL_NOT_SET';
88
public const ERROR_EMPTY_CONTENT = 'EMPTY_CONTENT';
99
public const ERROR_INTERNAL = 'INTERNAL_ERROR';
1010
public const ERROR_NOT_LOGGED_IN = 'NOT_LOGGED_IN';
1111

12-
public bool $acl_allowed = false;
1312
public ?\BNETDocs\Libraries\Comment $comment = null;
1413
public ?string $origin = null;
1514
public ?array $response = null;
1615

1716
public function jsonSerialize(): mixed
1817
{
1918
return \array_merge(parent::jsonSerialize(), [
20-
'acl_allowed' => $this->acl_allowed,
2119
'comment' => $this->comment,
2220
'origin' => $this->origin,
2321
'response' => $this->response,

src/Models/Comment/Delete.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
namespace BNETDocs\Models\Comment;
44

5-
class Delete extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class Delete extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
77
public const ERROR_ACL_NOT_SET = 'ACL_NOT_SET';
88
public const ERROR_INTERNAL = 'INTERNAL_ERROR';
99
public const ERROR_NOT_FOUND = 'NOT_FOUND';
1010
public const ERROR_NOT_LOGGED_IN = 'NOT_LOGGED_IN';
1111

12-
public bool $acl_allowed = false;
1312
public ?\BNETDocs\Libraries\Comment $comment = null;
1413
public ?string $content = null;
1514
public ?int $id = null;
@@ -19,7 +18,6 @@ class Delete extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
1918
public function jsonSerialize(): mixed
2019
{
2120
return \array_merge(parent::jsonSerialize(), [
22-
'acl_allowed' => $this->acl_allowed,
2321
'comment' => $this->comment,
2422
'content' => $this->content,
2523
'id' => $this->id,

src/Models/Comment/Edit.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
namespace BNETDocs\Models\Comment;
44

5-
class Edit extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class Edit extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
77
public const ERROR_ACL_NOT_SET = 'ACL_NOT_SET';
88
public const ERROR_EMPTY_CONTENT = 'EMPTY_CONTENT';
99
public const ERROR_INTERNAL = 'INTERNAL_ERROR';
1010
public const ERROR_NOT_FOUND = 'NOT_FOUND';
1111
public const ERROR_NOT_LOGGED_IN = 'NOT_LOGGED_IN';
1212

13-
public bool $acl_allowed = false;
1413
public ?\BNETDocs\Libraries\Comment $comment = null;
1514
public ?string $content = null;
1615
public ?int $id = null;
@@ -21,7 +20,6 @@ class Edit extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
2120
public function jsonSerialize(): mixed
2221
{
2322
return \array_merge(parent::jsonSerialize(), [
24-
'acl_allowed' => $this->acl_allowed,
2523
'comment' => $this->comment,
2624
'content' => $this->content,
2725
'id' => $this->id,

src/Models/Core/AccessControl.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace BNETDocs\Models\Core;
4+
5+
class AccessControl extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
6+
{
7+
/**
8+
* Stores whether $this->active_user is permitted to access this controller.
9+
*
10+
* @var bool
11+
*/
12+
public bool $acl_allowed = false;
13+
14+
/**
15+
* Implements the JSON serialization function from the JsonSerializable interface.
16+
*/
17+
public function jsonSerialize(): mixed
18+
{
19+
return \array_merge(parent::jsonSerialize(), ['acl_allowed' => $this->acl_allowed]);
20+
}
21+
}

src/Models/Core/HttpForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace BNETDocs\Models\Core;
44

5-
class HttpForm extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class HttpForm extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
77
/**
88
* The key-value store of the form.

src/Models/Document/Create.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
namespace BNETDocs\Models\Document;
44

5-
class Create extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class Create extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
77
public const ERROR_ACL_NOT_SET = 'ACL_NOT_SET';
88
public const ERROR_EMPTY_CONTENT = 'EMPTY_CONTENT';
99
public const ERROR_EMPTY_TITLE = 'EMPTY_TITLE';
1010
public const ERROR_INTERNAL = 'INTERNAL_ERROR';
1111
public const ERROR_NOT_LOGGED_IN = 'NOT_LOGGED_IN';
12-
13-
public bool $acl_allowed = false;
12+
1413
public ?string $brief = null;
1514
public ?string $content = null;
1615
public bool $markdown = true;
@@ -19,7 +18,6 @@ class Create extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
1918
public function jsonSerialize(): mixed
2019
{
2120
return \array_merge(parent::jsonSerialize(), [
22-
'acl_allowed' => $this->acl_allowed,
2321
'brief' => $this->brief,
2422
'content' => $this->content,
2523
'markdown' => $this->markdown,

src/Models/Document/Delete.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,20 @@
22

33
namespace BNETDocs\Models\Document;
44

5-
class Delete extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class Delete extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
77
public const ERROR_ACL_NOT_SET = 'ACL_NOT_SET';
88
public const ERROR_INTERNAL = 'INTERNAL_ERROR';
99
public const ERROR_NOT_FOUND = 'NOT_FOUND';
1010
public const ERROR_NOT_LOGGED_IN = 'NOT_LOGGED_IN';
1111

12-
public bool $acl_allowed = false;
1312
public ?\BNETDocs\Libraries\Document $document = null;
1413
public ?int $id = null;
1514
public ?string $title = null;
1615

1716
public function jsonSerialize(): mixed
1817
{
1918
return \array_merge(parent::jsonSerialize(), [
20-
'acl_allowed' => $this->acl_allowed,
2119
'document' => $this->document,
2220
'id' => $this->id,
2321
'title' => $this->title,

src/Models/Document/Edit.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace BNETDocs\Models\Document;
44

5-
class Edit extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class Edit extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
77
public const ERROR_ACL_NOT_SET = 'ACL_NOT_SET';
88
public const ERROR_EMPTY_CONTENT = 'EMPTY_CONTENT';
@@ -11,7 +11,6 @@ class Edit extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
1111
public const ERROR_NOT_FOUND = 'NOT_FOUND';
1212
public const ERROR_NOT_LOGGED_IN = 'NOT_LOGGED_IN';
1313

14-
public bool $acl_allowed = false;
1514
public ?string $brief = null;
1615
public ?string $category = null;
1716
public ?array $comments = null;
@@ -25,7 +24,6 @@ class Edit extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
2524
public function jsonSerialize(): mixed
2625
{
2726
return \array_merge(parent::jsonSerialize(), [
28-
'acl_allowed' => $this->acl_allowed,
2927
'brief' => $this->brief,
3028
'category' => $this->category,
3129
'comments' => $this->comments,

src/Models/Document/View.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
namespace BNETDocs\Models\Document;
44

5-
class View extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class View extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
7-
public bool $acl_allowed = false;
87
public ?array $comments = null;
98
public ?\BNETDocs\Libraries\Document $document = null;
109
public ?int $document_id = null;
1110

1211
public function jsonSerialize(): mixed
1312
{
1413
return \array_merge(parent::jsonSerialize(), [
15-
'acl_allowed' => $this->acl_allowed,
1614
'comments' => $this->comments,
1715
'document' => $this->document,
1816
'document_id' => $this->document_id,

src/Models/EventLog/Index.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
namespace BNETDocs\Models\EventLog;
44

5-
class Index extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
5+
class Index extends \BNETDocs\Models\Core\AccessControl implements \JsonSerializable
66
{
7-
public bool $acl_allowed = false;
87
public ?array $events = null;
98
public int $limit = 0;
109
public string $order = '';
@@ -15,7 +14,6 @@ class Index extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
1514
public function jsonSerialize(): mixed
1615
{
1716
return \array_merge(parent::jsonSerialize(), [
18-
'acl_allowed' => $this->acl_allowed,
1917
'events' => $this->events,
2018
'limit' => $this->limit,
2119
'order' => $this->order,

0 commit comments

Comments
 (0)