id = $data['uid'] ?? null; // 'uid' maps to 'id' $this->identity = $data['identity'] ?? null; $this->label = $data['label'] ?? null; $this->roles = (array)($data['roles'] ?? []); $this->enabled = $data['enabled'] ?? null; $this->provider = $data['provider'] ?? null; $this->externalSubject = $data['external_subject'] ?? null; $this->initialLogin = $data['initial_login'] ?? null; $this->recentLogin = $data['recent_login'] ?? null; $this->permissions = (array)($data['permissions'] ?? []); } if ($source === 'jwt') { $this->id = $data['identifier'] ?? null; $this->identity = $data['identity'] ?? null; $this->label = $data['label'] ?? null; $this->roles = (array)($data['role'] ?? []); $this->permissions = (array)($data['permissions'] ?? []); $this->enabled = true; } if ($source === 'external') { $this->identity = $data['identity'] ?? null; $this->label = $data['label'] ?? null; $this->externalSubject = $data['external_subject'] ?? null; $this->provider = $data['provider'] ?? null; } } public function getId(): ?string { return $this->id; } public function setId(string $value): void { $this->id = $value; } public function getIdentity(): ?string { return $this->identity; } public function setIdentity(string $value): void { $this->identity = $value; } public function getLabel(): ?string { return $this->label; } public function setLabel(?string $value): void { $this->label = $value; } public function getRoles(): array { return $this->roles; } public function setRoles(array $values): void { $this->roles = $values; } public function getEnabled(): ?bool { return $this->enabled; } public function setEnabled(?bool $value): void { $this->enabled = $value; } public function getProvider(): ?string { return $this->provider; } public function setProvider(?string $value): void { $this->provider = $value; } public function getExternalSubject(): ?string { return $this->externalSubject; } public function setExternalSubject(?string $value): void { $this->externalSubject = $value; } public function getInitialLogin(): ?int { return $this->initialLogin; } public function setInitialLogin(?int $value): void { $this->initialLogin = $value; } public function getRecentLogin(): ?int { return $this->recentLogin; } public function setRecentLogin(?int $value): void { $this->recentLogin = $value; } public function getPermissions(): array { return $this->permissions; } public function setPermissions(array $permissions): void { $this->permissions = $permissions; } public function hasPermission(string $permission): bool { return in_array($permission, $this->permissions, true); } }