-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
s3b4stian
committed
Nov 20, 2023
1 parent
8b91ab0
commit 820a035
Showing
14 changed files
with
552 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the Linna Framework. | ||
* | ||
* @author Sebastian Rapetti <sebastian.rapetti@tim.it> | ||
* @copyright (c) 2018, Sebastian Rapetti | ||
* @license http://opensource.org/licenses/MIT MIT License | ||
*/ | ||
|
||
namespace Linna\Authorization; | ||
|
||
use DateTimeImmutable; | ||
use Linna\Authentication\User; | ||
use Linna\DataMapper\DomainObjectAbstract; | ||
|
||
/** | ||
* RoleExtended domain object. | ||
*/ | ||
class RoleExtended extends Role | ||
{ | ||
use PermissionTrait; | ||
use UserTrait; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param string $name The name of the role. | ||
* @param string $description The description of the role. | ||
* @param integer $active Specify is the role is atctive. | ||
* @param array<mixed> $users Users in role. | ||
* @param array<mixed> $permissions Permissions granted by the role. | ||
*/ | ||
public function __construct( | ||
//role id | ||
null|int|string $id = null, | ||
|
||
/** @var string Group name. */ | ||
public string $name = '', | ||
|
||
/** @var string Group description. */ | ||
public string $description = '', | ||
|
||
/** @var int It say if group is active or not. */ | ||
public int $active = 0, | ||
|
||
//users in role | ||
array $users = [], | ||
|
||
//permissions in role | ||
array $permissions = [], | ||
|
||
//creation datetime | ||
?DateTimeImmutable $created = new DateTimeImmutable(), | ||
|
||
//last updated datetime | ||
?DateTimeImmutable $lastUpdate = new DateTimeImmutable() | ||
) { | ||
//initialize parent | ||
parent::__construct( | ||
id: $id, | ||
name: $name, | ||
description: $description, | ||
active: $active, | ||
created: $created, | ||
lastUpdate: $lastUpdate | ||
); | ||
|
||
//from user trait | ||
$this->user = $users; | ||
|
||
//from permission trait | ||
$this->permission = $permissions; | ||
} | ||
} |
Oops, something went wrong.