/** * Update (or create) an ACL. * * @param AclEvent $event ACL event. * * @throws PropelException */ public function aclUpdate(AclEvent $event) { // create the ACL if it does not exists if (null == ($acl = AclQuery::create()->findPk($event->getId()))) { $acl = new Acl(); } $acl->setCode($event->getCode())->setModuleId($event->getModuleId())->setLocale($event->getLocale())->setTitle($event->getTitle())->setDescription($event->getDescription())->save(); }
/** * Parse the acl in acl.xml file * @param SimpleXMLElement $xml The xml parsed by parseFile * @param Module $module The enabled module */ protected function parseAcls(SimpleXMLElement $xml, Module $module) { //If there are no acl node continue to parse the xml $acls = $xml->xpath('//config:acls/config:acl'); if (false === $acls) { return; } //Add the acl if they no exists and parse his descriptive /** @var SimpleXMLElement $acl */ foreach ($acls as $acl) { $code = $acl->getAttributeAsPHP("code"); if (AclQuery::create()->findOneByCode($code)) { continue; } $newAcl = new Acl(); $newAcl->setCode($code)->setModuleId($module->getId()); $newAcl->save(); $this->parseDescriptives($acl); } }
/** * Declares an association between this object and a ChildAcl object. * * @param ChildAcl $v * @return \CustomerGroupAcl\Model\AclI18n The current object (for fluent API support) * @throws PropelException */ public function setAcl(ChildAcl $v = null) { if ($v === null) { $this->setId(NULL); } else { $this->setId($v->getId()); } $this->aAcl = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the ChildAcl object, it will not be re-added. if ($v !== null) { $v->addAclI18n($this); } return $this; }
/** * Filter the query by a related \CustomerGroupAcl\Model\Acl object * * @param \CustomerGroupAcl\Model\Acl|ObjectCollection $acl The related object(s) to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return ChildCustomerGroupAclQuery The current query, for fluid interface */ public function filterByAcl($acl, $comparison = null) { if ($acl instanceof \CustomerGroupAcl\Model\Acl) { return $this->addUsingAlias(CustomerGroupAclTableMap::ACL_ID, $acl->getId(), $comparison); } elseif ($acl instanceof ObjectCollection) { if (null === $comparison) { $comparison = Criteria::IN; } return $this->addUsingAlias(CustomerGroupAclTableMap::ACL_ID, $acl->toKeyValue('PrimaryKey', 'Id'), $comparison); } else { throw new PropelException('filterByAcl() only accepts arguments of type \\CustomerGroupAcl\\Model\\Acl or Collection'); } }
/** * Exclude object from result * * @param ChildAcl $acl Object to remove from the list of results * * @return ChildAclQuery The current query, for fluid interface */ public function prune($acl = null) { if ($acl) { $this->addUsingAlias(AclTableMap::ID, $acl->getId(), Criteria::NOT_EQUAL); } return $this; }