Hydrate a acl object into a AclEntity object

@param stdClass $acl
@return AclEntity
483710
public static function hydrate(stdClass $acl)
    {
        $hydrated = new AclEntity();

        if (isset($acl->id)) {
            $hydrated->setId($acl->id);
        }

        if (isset($acl->owner_user)) {
            $hydrated->setOwnerUser(UserHydrator::hydrate($acl->owner_user));
        }

        if (isset($acl->owner_team)) {
            $hydrated->setOwnerTeam(TeamHydrator::hydrate($acl->owner_team));
        }

        if (isset($acl->quota)) {
            $hydrated->setQuota(QuotaHydrator::hydrate($acl->quota));
        }

        if (isset($acl->created_by)) {
            $hydrated->setCreatedBy(UserHydrator::hydrate($acl->created_by));
        }

        if (isset($acl->view)) {
            $hydrated->setView($acl->view);
        }

        if (isset($acl->delete)) {
            $hydrated->setDelete($acl->delete);
        }

        if (isset($acl->create)) {
            $hydrated->setCreate($acl->create);
        }

        if (isset($acl->edit)) {
            $hydrated->setEdit($acl->edit);
        }

        if (isset($acl->use)) {
            $hydrated->setUse($acl->use);
        }

        if (isset($acl->manage)) {
            $hydrated->setManage($acl->manage);
        }

        if (isset($acl->immutable)) {
            $hydrated->setImmutable($acl->immutable);
        }

        return $hydrated;
    }
1029241
public static function hydrate(stdClass $upload)
    {
        $hydrated = new UploadEntity;

        if (isset($upload->id)) {
            $hydrated->setId($upload->id);
        }

        if (isset($upload->created_at)) {
            $hydrated->setCreatedAt(new DateTime($upload->created_at));
        }

        if (isset($upload->name)) {
            $hydrated->setName($upload->name);
        }

        if (isset($upload->extension)) {
            $hydrated->setExtension($upload->extension);
        }

        if (isset($upload->size)) {
            $hydrated->setSize($upload->size);
        }

        if (isset($upload->file)) {
            $hydrated->setFile($upload->file);
        }

        if (isset($upload->created_by)) {
            $hydrated->setCreatedBy(UserHydrator::hydrate($upload->created_by));
        }

        if (isset($upload->application)) {
            $hydrated->setApplication(ApplicationHydrator::hydrate($upload->application));
        }

        return $hydrated;
    }
1011286
public function hydrate(array $data, $object)
    {
        if (! $object instanceof Entity) {
            return $object;
        }
                
        parent::hydrate($data, $object);
               
        $authEntity = parent::hydrate($data, new \Pacificnm\Auth\Entity\Entity());
        
        $object->setAuthEntity($authEntity);
        
        $aclRoleEntity = parent::hydrate($data, new \Pacificnm\AclRole\Entity\Entity());
        
        $object->getAuthEntity()->setAclRoleEntity($aclRoleEntity);
        
        return $object;
    }
1047268
protected function doApplyPermission(MutableAclInterface $acl, PermissionContextInterface $context, $replace_existing = false)
    {
        $type = $context->getPermissionType();
        $field = $context->getField();
        if (is_null($field)) {
            $aceCollection = $this->getAceCollection($acl, $type);
        } else {
            $aceCollection = $this->getFieldAceCollection($acl, $type, $field);
        }
        $size = count($aceCollection) - 1;
        reset($aceCollection);
        for ($i = $size; $i >= 0; $i--) {
            if ($replace_existing) {
                // Replace all existing permissions with the new one
                if ($context->hasDifferentPermission($aceCollection[$i])) {
                    // The ACE was found but with a different permission. Update it.
                    if (is_null($field)) {
                        $acl->{"update{$type}Ace"}($i, $context->getMask());
                    } else {
                        $acl->{"update{$type}FieldAce"}($id, $field, $context-getMask());
                    }
                    //No need to proceed further because the acl is updated
                    return;
                } else {
                    if ($context->equals($aceCollection[$i])) {
                        // The exact same ACE was found. Nothing to do.
                        return;

                    }
                }
            } else {
                if ($context->equals($aceCollection[$i])) {
                    // The exact same ACE was found. Nothing to do.
                    return;
                }
            }
        }
        //If we come this far means we have to insert ace
        if (is_null($field)) {
            $acl->{"insert{$type}Ace"}($context->getSecurityIdentity(),
                    $context->getMask(), 0, $context->isGranting());
        } else {
            $acl->{"insert{$type}FieldAce"}($field, $context->getSecurityIdentity(),
                    $context->getMask(), 0, $context->isGranting());
        }
    }
1095743
public static function hydrate(stdClass $customClass)
    {
        $hydrated = new CustomClassEntity();

        if (isset($customClass->id)) {
            $hydrated->setId($customClass->id);
        }

        if (isset($customClass->start_line)) {
            $hydrated->setStartLine($customClass->start_line);
        }

        if (isset($customClass->end_line)) {
            $hydrated->setEndLine($customClass->end_line);
        }

        if (isset($customClass->start_column)) {
            $hydrated->setStartColumn($customClass->start_column);
        }

        if (isset($customClass->end_column)) {
            $hydrated->setEndColumn($customClass->end_column);
        }

        if (isset($customClass->name)) {
            $hydrated->setName($customClass->name);
        }

        if (isset($customClass->file)) {
            $hydrated->setFile(FileHydrator::hydrate($customClass->file));
        }
    
        if (isset($customClass->package)) {
            $hydrated->setPackage($customClass->package);
        }

        return $hydrated;
    }
754577
public function setDefaultAcl($aclId) {
	
		// set no default to siblings
		Database::run('UPDATE `acl` SET `is_default` = 0 WHERE `group_id` = ? AND `id` <> ?', [$this->id, $aclId]);

		// set default to this
		Database::run('UPDATE `acl` SET `is_default` = 1 WHERE `group_id` = ? AND `id` = ?', [$this->id, $aclId]);
		
	}
65611
public static function hydrate(stdClass $library)
    {
        $hydrated = new LibraryEntity();

        if (isset($library->id)) {
            $hydrated->setId($library->id);
        }

        if (isset($library->name)) {
            $hydrated->setName($library->name);
        }

        if (isset($library->version)) {
            $hydrated->setVersion($library->version);
        }

        if (isset($library->implementation)) {
            $hydrated->setImplementation($library->implementation);
        }

        if (isset($library->group)) {
            $hydrated->setGroup($library->group);
        }

        return $hydrated;
    }
838401
function(acl) {
                var args = {
                    url: this.buildUri(this.type, this.id),
                    method: corbel.request.method.PUT,
                    data: acl,
                    Accept: 'application/corbel.acl+json'
                };

                return this.request(args);
            }
225195
private function unserializeAcl($serialized)
    {
        $acl      = unserialize($serialized);
        $parentId = $acl->getParentAcl();

        if (null !== $parentId) {
            $parentAcl = $this->getFromCacheById($parentId);

            if (null === $parentAcl) {
                return null;
            }

            $acl->setParentAcl($parentAcl);
        }

        $reflectionProperty = new \ReflectionProperty($acl, 'permissionGrantingStrategy');

        $reflectionProperty->setAccessible(true);
        $reflectionProperty->setValue($acl, $this->permissionGrantingStrategy);
        $reflectionProperty->setAccessible(false);

        $aceAclProperty = new \ReflectionProperty('Symfony\Component\Security\Acl\Domain\Entry', 'acl');

        $aceAclProperty->setAccessible(true);

        foreach ($acl->getObjectAces() as $ace) {
            $aceAclProperty->setValue($ace, $acl);
        }

        foreach ($acl->getClassAces() as $ace) {
            $aceAclProperty->setValue($ace, $acl);
        }

        $aceClassFieldProperty = new \ReflectionProperty($acl, 'classFieldAces');

        $aceClassFieldProperty->setAccessible(true);

        foreach ($aceClassFieldProperty->getValue($acl) as $aces) {
            foreach ($aces as $ace) {
                $aceAclProperty->setValue($ace, $acl);
            }
        }

        $aceClassFieldProperty->setAccessible(false);

        $aceObjectFieldProperty = new \ReflectionProperty($acl, 'objectFieldAces');

        $aceObjectFieldProperty->setAccessible(true);

        foreach ($aceObjectFieldProperty->getValue($acl) as $aces) {
            foreach ($aces as $ace) {
                $aceAclProperty->setValue($ace, $acl);
            }
        }

        $aceObjectFieldProperty->setAccessible(false);

        $aceAclProperty->setAccessible(false);

        return $acl;
    }
616226
public static function hydrate(stdClass $context)
    {
        $hydrated = new ContextEntity();

        if (isset($context->id)) {
            $hydrated->setId($context->id);
        }

        if (isset($context->parts)) {
            $hydrated->setParts(PartHydrator::hydrateCollection($context->parts));
        }

        return $hydrated;
    }
328882
public function getContextualAcl()
    {
        $acl = $this->getRules();
        if (!$acl->hasRole($this->getContextId())) {
            $contextRoles = $this->getContext()->getRoles();
            if ($contextRoles instanceof RoleBucket) {
                $contextRoles = $contextRoles->toArray();
            }
            $acl->addRole(new Role($this->getContextId()), $contextRoles);
        }
        return $acl;
    }
1316390
private function updateAceIdentityMap(AclInterface $acl)
    {
        foreach (array('classAces', 'classFieldAces', 'objectAces', 'objectFieldAces') as $property) {
            $reflection = new \ReflectionProperty($acl, $property);
            $reflection->setAccessible(true);
            $value = $reflection->getValue($acl);

            if ('classAces' === $property || 'objectAces' === $property) {
                $this->doUpdateAceIdentityMap($value);
            } else {
                foreach ($value as $field => $aces) {
                    $this->doUpdateAceIdentityMap($value[$field]);
                }
            }

            $reflection->setValue($acl, $value);
            $reflection->setAccessible(false);
        }
    }
1225982
public static function hydrate(stdClass $sink)
    {
        $hydrated = new SinkEntity();

        if (isset($sink->id)) {
            $hydrated->setId($sink->id);
        }

        if (isset($sink->class)) {
            $hydrated->setClass($sink->class);
        }

        if (isset($sink->method)) {
            $hydrated->setMethod($sink->method);
        }

        if (isset($sink->parameter)) {
            $hydrated->setParameter($sink->parameter);
        }

        if (isset($sink->type)) {
            $hydrated->setType(TypeHydrator::hydrate($sink->type));
        }

        return $hydrated;
    }
442630
def get(self, acl):
        
        return self._instance._client.acls.get(self._instance.name, acl)
1259530
public function getAcl() {
        $returnVar = $this->getDi()->get(AclInterface::DI_NAME);
        if(!($returnVar instanceof AclInterface)) {
            throw new \Exception('The Acl must implement: ' . AclInterface::class);
        }
        return $returnVar;
    }
1263468
protected function getAuthorizationActions(AuthorizationContract $acl, $metric)
    {
        return collect($acl->actions()->get())->map(function ($slug) use ($metric) {
            $key = "orchestra/foundation::acl.{$metric}.{$slug}";
            $name = $this->translator->has($key) ? $this->translator->get($key) : Str::humanize($slug);

            return compact('slug', 'name');
        });
    }
230750
public function authorize(Authorization $acl)
    {
        $active = (extension_active('ban_management') or extension_active('two_factor_auth'));

        if (!$active) {
            return false;
        }
        return $acl->can('manage-antares');
    }