mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-12-06 11:22:41 +01:00
Added inherit managers attribute to resources
This commit is contained in:
parent
f7b3b2f255
commit
fdb4b8fc76
8 changed files with 65 additions and 4 deletions
|
@ -24,6 +24,7 @@ class FolderResource extends Resource {
|
|||
$instance->setOrganizationFolderId($row["organization_folder_id"]);
|
||||
$instance->setName($row["name"]);
|
||||
$instance->setActive($row["active"]);
|
||||
$instance->setInheritManagers($row["inherit_managers"]);
|
||||
$instance->setLastUpdatedTimestamp($row["last_updated_timestamp"]);
|
||||
$instance->setMembersAclPermission($row["members_acl_permission"]);
|
||||
$instance->setManagersAclPermission($row["managers_acl_permission"]);
|
||||
|
@ -43,6 +44,7 @@ class FolderResource extends Resource {
|
|||
'type' => "folder",
|
||||
'name' => $this->name,
|
||||
'active' => $this->active,
|
||||
'inheritManagers' => $this->inheritManagers,
|
||||
'lastUpdatedTimestamp' => $this->lastUpdatedTimestamp,
|
||||
|
||||
'membersAclPermission' => $this->membersAclPermission,
|
||||
|
@ -58,6 +60,7 @@ class FolderResource extends Resource {
|
|||
'Name' => $this->name,
|
||||
'Type' => "Folder",
|
||||
'Active' => ((bool)$this->active) ? 'yes' : 'no',
|
||||
'Inherit Managers' => ((bool)$this->inheritManagers) ? 'yes' : 'no',
|
||||
'Last Updated' => $this->lastUpdatedTimestamp,
|
||||
|
||||
'Members ACL Permission' => $this->membersAclPermission,
|
||||
|
|
|
@ -12,12 +12,14 @@ abstract class Resource extends Entity implements JsonSerializable, TableSeriali
|
|||
protected $parentResource;
|
||||
protected $name;
|
||||
protected $active;
|
||||
protected $inheritManagers;
|
||||
protected $lastUpdatedTimestamp;
|
||||
|
||||
public function __construct() {
|
||||
$this->addType('organizationFolderId','integer');
|
||||
$this->addType('parentResource','integer');
|
||||
$this->addType('active','bool');
|
||||
$this->addType('inheritManagers','bool');
|
||||
$this->addType('lastUpdatedTimestamp','integer');
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class ResourceMapper extends QBMapper {
|
|||
public const RESOURCES_TABLE = "organizationfolders_resources";
|
||||
public const FOLDER_RESOURCES_TABLE = "organizationfolders_folder_resources";
|
||||
|
||||
private const updateableResourceProperties = ["parentResource", "active", "name", "lastUpdatedTimestamp"];
|
||||
private const updateableResourceProperties = ["parentResource", "active", "name", "inheritManagers", "lastUpdatedTimestamp"];
|
||||
private const updateableFolderResourceProperties = ["membersAclPermission", "managersAclPermission", "inheritedAclPermission", "fileId"];
|
||||
|
||||
public function __construct(IDBConnection $db) {
|
||||
|
|
|
@ -49,4 +49,23 @@ class ResourceMember extends Entity implements JsonSerializable, TableSerializab
|
|||
'LastUpdated' => $this->lastUpdatedTimestamp,
|
||||
];
|
||||
}
|
||||
|
||||
public function getParsedPrincipal() {
|
||||
if($this->type === MemberType::USER->value) {
|
||||
return [
|
||||
"userId" => $this->principal,
|
||||
];
|
||||
} else if($this->type === MemberType::GROUP->value) {
|
||||
return [
|
||||
"groupId" => $this->principal,
|
||||
];
|
||||
} else if($this->type === MemberType::ROLE->value) {
|
||||
[$organizationProviderId, $roleId] = explode(":", $this->principal, 2);
|
||||
|
||||
return [
|
||||
"organizationProviderId" => $organizationProviderId,
|
||||
"roleId" => $roleId,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue