Author: Johannes M. Schmitt (schmittjoh@gmail.com)
Author: Christophe Coevoet (stof@notk.org)
コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function updateGroup(GroupInterface $group)
 {
     if (!$group instanceof \Persistent) {
         throw new \InvalidArgumentException('This group instance is not supported by the Propel GroupManager implementation');
     }
     $group->save();
 }
コード例 #2
0
 /**
  * @param string string         $username
  * @param string GroupInterface $group
  *
  * @return array
  */
 public function findByIncludedUsernameWithoutGroup($username, GroupInterface $group)
 {
     $qb = $this->createQueryBuilder();
     $qb->field('groups.$id')->notEqual(new \MongoId($group->getId()));
     $qb->field('username')->equals(new \MongoRegex('/.*' . $username . '.*/i'));
     return $qb->getQuery()->execute();
 }
コード例 #3
0
 /**
  * get Array with Principal-Data from User-Object.
  *
  * @param UserInterface|GroupInterface $principalObject
  * @param bool                         $show_id
  *
  * @return array
  *
  * @throws Exception
  */
 private function getPrincipalArray($principalObject, $show_id = false)
 {
     if (!$principalObject instanceof UserInterface && !$principalObject instanceof GroupInterface) {
         throw new Exception('$principalObject must be of type UserInterface of GroupInterface');
     }
     $principal = array();
     if ($show_id) {
         $principal['id'] = $principalObject->getId();
     }
     if ($principalObject instanceof UserInterface) {
         $principal['uri'] = 'principals/' . $principalObject->getUsername();
     } else {
         $principal['uri'] = 'principals/' . $principalObject->getName();
     }
     // get all fields from $this->fieldMap, additional to 'uri' and 'id'
     foreach ($this->fieldMap as $key => $value) {
         if (!method_exists($principalObject, $value['getter'])) {
             continue;
         }
         $valueGetter = call_user_func(array($principalObject, $value['getter']));
         if ($valueGetter) {
             $principal[$key] = $valueGetter;
         }
     }
     return $principal;
 }
コード例 #4
0
ファイル: User.php プロジェクト: 2remdou/nicetruc
 public function addGroup(GroupInterface $group)
 {
     if (!in_array($group->getRoles(), $this->getRoles())) {
         $this->addRole($group->getRoles());
     }
     if (!$this->getGroups()->contains($group)) {
         $this->getGroups()->add($group);
     }
     return $this;
 }
コード例 #5
0
 /**
  * @param GroupInterface $group
  * @return string
  */
 public static function getGroupAlias(GroupInterface $group)
 {
     return 'sf_group_' . $group->getId();
 }
コード例 #6
0
 /**
  * @param string         $message
  * @param GroupInterface $group
  */
 protected function sendLog($message, GroupInterface $group)
 {
     $this->logger->info($message, array('group_name' => $group->getName()));
 }