beeframework-svn Mailing List for Bee Framework (Page 8)
Brought to you by:
b_hartmann,
m_plomer
You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(12) |
Jun
(5) |
Jul
(6) |
Aug
(25) |
Sep
(25) |
Oct
(6) |
Nov
(29) |
Dec
|
2014 |
Jan
(2) |
Feb
(10) |
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
(35) |
Aug
(9) |
Sep
(33) |
Oct
(30) |
Nov
(4) |
Dec
(1) |
2015 |
Jan
(3) |
Feb
(13) |
Mar
(13) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <m_p...@us...> - 2013-11-06 12:36:09
|
Revision: 121 http://sourceforge.net/p/beeframework/code/121 Author: m_plomer Date: 2013-11-06 12:36:06 +0000 (Wed, 06 Nov 2013) Log Message: ----------- - DaoBase: minor optimization and som cleanup Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2013-11-06 01:26:31 UTC (rev 120) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2013-11-06 12:36:06 UTC (rev 121) @@ -1,8 +1,11 @@ <?php namespace Bee\Persistence\Doctrine2; -use Bee_Framework; +use Bee_Persistence_IOrderAndLimitHolder; +use Bee_Persistence_IRestrictionHolder; +use Bee_Utils_Strings; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; +use Exception; use Logger; /** @@ -28,16 +31,14 @@ } /** - * @param \Doctrine\ORM\QueryBuilder $queryBuilder - * @param \Bee_Persistence_IRestrictionHolder $restrictionHolder - * @param \Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder + * @param QueryBuilder $queryBuilder + * @param Bee_Persistence_IRestrictionHolder $restrictionHolder + * @param Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping - * * @param null $hydrationMode - * @internal param \Doctrine\ORM\QueryBuilder $query * @return array */ - public function executeListQuery(\Doctrine\ORM\QueryBuilder $queryBuilder, \Bee_Persistence_IRestrictionHolder $restrictionHolder = null, \Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping, $hydrationMode = null) { + public function executeListQuery(QueryBuilder $queryBuilder, Bee_Persistence_IRestrictionHolder $restrictionHolder = null, Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping, $hydrationMode = null) { $this->applyFilterRestrictions($queryBuilder, $restrictionHolder); $this->applyOrderAndLimit($queryBuilder, $orderAndLimitHolder, $defaultOrderMapping); return $this->getQueryFromBuilder($queryBuilder)->execute(null, $hydrationMode); @@ -52,36 +53,37 @@ } /** - * @param \Doctrine\ORM\QueryBuilder $queryBuilder - * @param \Bee_Persistence_IRestrictionHolder $restrictionHolder - * @internal param \Doctrine\ORM\QueryBuilder $query + * @param QueryBuilder $queryBuilder + * @param Bee_Persistence_IRestrictionHolder $restrictionHolder + * @internal param QueryBuilder $query */ - protected final function applyFilterRestrictions(\Doctrine\ORM\QueryBuilder &$queryBuilder, \Bee_Persistence_IRestrictionHolder $restrictionHolder = null) { + protected final function applyFilterRestrictions(QueryBuilder &$queryBuilder, Bee_Persistence_IRestrictionHolder $restrictionHolder = null) { if (is_null($restrictionHolder)) { return; } - if (!\Bee_Utils_Strings::hasText($restrictionHolder->getFilterString())) { + if (!Bee_Utils_Strings::hasText($restrictionHolder->getFilterString())) { return; } - $filterTokens = \Bee_Utils_Strings::tokenizeToArray($restrictionHolder->getFilterString(), ' '); + $filterTokens = Bee_Utils_Strings::tokenizeToArray($restrictionHolder->getFilterString(), ' '); foreach ($filterTokens as $no => $token) { $andWhereString = ''; $params = array(); + $tokenName = 'filtertoken'.$no; + $params[$tokenName] = '%'.$token.'%'; + foreach ($restrictionHolder->getFilterableFields() as $fieldName) { // $fieldName MUST BE A DOCTRINE NAME - if (\Bee_Utils_Strings::hasText($andWhereString)) { + if (Bee_Utils_Strings::hasText($andWhereString)) { $andWhereString .= ' OR '; } - $tokenName = 'filtertoken'.$no; $andWhereString .= $fieldName.' LIKE :'.$tokenName; - $params[$tokenName] = '%'.$token.'%'; } - if (\Bee_Utils_Strings::hasText($andWhereString)) { + if (Bee_Utils_Strings::hasText($andWhereString)) { $queryBuilder->andWhere($andWhereString); foreach ($params as $key => $value) { @@ -92,11 +94,11 @@ } /** - * @param \Doctrine\ORM\QueryBuilder $queryBuilder - * @param \Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder + * @param QueryBuilder $queryBuilder + * @param Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping */ - protected final function applyOrderAndLimit(\Doctrine\ORM\QueryBuilder &$queryBuilder, \Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = array()) { + protected final function applyOrderAndLimit(QueryBuilder &$queryBuilder, Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = array()) { if (is_null($orderAndLimitHolder)) { $orderMapping = $defaultOrderMapping; } else { @@ -128,7 +130,7 @@ /** * @param callback $func - * @throws \Exception + * @throws Exception * @return mixed */ public function doInTransaction($func) { @@ -144,7 +146,7 @@ $this->getLog()->info('Transaction committed!'); return $result; - } catch (\Exception $e) { + } catch (Exception $e) { $this->getLog()->warn('Exception caught, rolling back!', $e); $this->getEntityManager()->rollBack(); throw $e; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-06 01:26:38
|
Revision: 120 http://sourceforge.net/p/beeframework/code/120 Author: m_plomer Date: 2013-11-06 01:26:31 +0000 (Wed, 06 Nov 2013) Log Message: ----------- tagged latest changes Added Paths: ----------- tags/0.9.13/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-06 01:25:40
|
Revision: 119 http://sourceforge.net/p/beeframework/code/119 Author: m_plomer Date: 2013-11-06 01:25:35 +0000 (Wed, 06 Nov 2013) Log Message: ----------- - BasicBeanDefinitionRegistry: introduced parent chain Modified Paths: -------------- trunk/framework/Bee/Context/Abstract.php trunk/framework/Bee/Context/Config/BasicBeanDefinitionRegistry.php Modified: trunk/framework/Bee/Context/Abstract.php =================================================================== --- trunk/framework/Bee/Context/Abstract.php 2013-11-05 23:30:23 UTC (rev 118) +++ trunk/framework/Bee/Context/Abstract.php 2013-11-06 01:25:35 UTC (rev 119) @@ -103,15 +103,17 @@ $this->registerScopes(); $this->loadBeanDefinitions(); } - + /** * This method is supposed to be protected, but due to php's inability to define * anonymous classes. - * + * * **** DON'T CALL THIS METHOD **** - * + * * @param String $beanName * @param Bee_Context_Config_IBeanDefinition $beanDefinition + * @throws Exception + * @return null|object */ public function _createBean($beanName, Bee_Context_Config_IBeanDefinition $beanDefinition) { $instance = null; @@ -129,12 +131,13 @@ public function setBeeContext(Bee_IContext $context) { $this->setParent($context); } - + /** - * - * @param String $beanName + * + * @param string $beanName * @param Bee_Context_Config_IBeanDefinition $beanDefinition - * @return Object + * @throws Bee_Context_BeanCreationException + * @return object */ protected function createBean($beanName, Bee_Context_Config_IBeanDefinition $beanDefinition) { @@ -178,20 +181,17 @@ return $bean; } - - + /** * Actually create the specified bean. Pre-creation processing has already happened * at this point, e.g. checking <code>postProcessBeforeInstantiation</code> callbacks. * <p>Differentiates between default bean instantiation, use of a * factory method, and autowiring a constructor. - * @param beanName the name of the bean - * @param mbd the merged bean definition for the bean - * @param args arguments to use if creating a prototype using explicit arguments to a - * static factory method. This parameter must be <code>null</code> except in this case. - * + * @param string $beanName name of the bean + * @param Bee_Context_Config_IBeanDefinition $beanDefinition + * @throws Bee_Context_BeanCreationException + * * @return Object a new instance of the bean - * @throws BeanCreationException if the bean could not be created * @see #instantiateBean * @see #instantiateUsingFactoryMethod * @see #autowireConstructor @@ -340,7 +340,7 @@ * @param String $beanName the name of the bean * @param Bee_Context_Config_IBeanDefinition $beanDefinition the bean definition for the bean * - * @return BeanWrapper for the new instance + * @return Bee_Beans_BeanWrapper for the new instance * @see #instantiateUsingFactoryMethod * @see #instantiateBean */ @@ -354,15 +354,16 @@ } - /** * Instantiate the bean using a named factory method. The method may be static, if the * mbd parameter specifies a class, rather than a factoryBean, or an instance variable * on a factory object itself configured using Dependency Injection. - * + * * @param String $beanName the name of the bean * @param Bee_Context_Config_IBeanDefinition $beanDefinition the bean definition for the bean - * @return BeanWrapper for the new instance + * @throws Bee_Context_BeanDefinitionStoreException + * @throws Bee_Context_BeanCreationException + * @return Bee_Beans_BeanWrapper for the new instance * @see #getBean(String, Object[]) */ protected function instantiateUsingFactoryMethod($beanName, Bee_Context_Config_IBeanDefinition $beanDefinition) { @@ -394,14 +395,14 @@ return call_user_func_array($factory, $this->createArgsArray($beanName, $beanDefinition)); } - - - + + /** * Enter description here... * * @param String $beanName * @param Bee_Context_Config_IBeanDefinition $beanDefinition + * @return object */ protected function instantiateBean($beanName, Bee_Context_Config_IBeanDefinition $beanDefinition) { $beanClassName = $beanDefinition->getBeanClassName(); @@ -427,7 +428,7 @@ } return $args; } - + /** * Apply the given property values, resolving any runtime references * to other beans in this context. @@ -435,6 +436,7 @@ * @param Bee_Context_Config_IBeanDefinition $beanDefinition the bean definition * @param Bee_Beans_BeanWrapper $beanWrapper the BeanWrapper wrapping the target object * @param Bee_Beans_PropertyValue[] $propertyValues the new property values + * @throws Bee_Context_BeanCreationException */ protected function applyPropertyValues($beanName, Bee_Context_Config_IBeanDefinition $beanDefinition, Bee_Beans_BeanWrapper $beanWrapper, array $propertyValues = null) { if (is_null($propertyValues) || count($propertyValues) === 0) { @@ -461,6 +463,7 @@ * @param $beanName * @param $beanInstance * @param MethodInvocation[] $methodInvocations + * @throws Bee_Context_InvalidPropertyException */ protected function invokeMethods($beanName, $beanInstance, array $methodInvocations = array()) { foreach($methodInvocations as $methodInvocation) { @@ -516,13 +519,13 @@ protected function afterBeanCreation($beanName) { unset($this->beansInCreation[$beanName]); } - - + /** * Return whether the specified bean is currently in creation. - * + * * @param String $beanName the name of the bean + * @return bool */ public function isBeanCurrentlyInCreation($beanName) { return array_key_exists($beanName, $this->beansInCreation); @@ -550,7 +553,7 @@ /** * Determine whether a dependent bean has been registered under the given name. - * @param String beanName the name of the bean + * @param string $beanName the name of the bean * @return boolean */ protected function hasDependentBean($beanName) { @@ -596,7 +599,7 @@ if ($this->containsBeanDefinition($beanName)) { return true; } - return (!is_null($this->getParent()) && $this->getParent()->containsBeanDefinition($beanName)); + return (!is_null($this->getParent()) && $this->getParent()->containsBean($beanName)); } @@ -648,15 +651,16 @@ } - /** - * Get the object for the given bean instance, either the bean - * instance itself or its created object in case of a FactoryBean. - * @param mixed $beanInstance the shared bean instance - * @param string $name name that may include factory dereference prefix - * @param string $beanName the canonical bean name - * @param Bee_Context_Config_IBeanDefinition $mbd the merged bean definition - * @return the object to expose for the bean - */ + /** + * Get the object for the given bean instance, either the bean + * instance itself or its created object in case of a FactoryBean. + * @param mixed $beanInstance the shared bean instance + * @param string $name name that may include factory dereference prefix + * @param string $beanName the canonical bean name + * @param Bee_Context_Config_IBeanDefinition $mbd the merged bean definition + * @throws Bee_Context_BeanIsNotAFactoryException + * @return object the object to expose for the bean + */ protected function getObjectForBeanInstance( $beanInstance, $name, $beanName, Bee_Context_Config_IBeanDefinition $mbd) { @@ -705,7 +709,7 @@ * @param string $beanName the name of the bean * @param boolean $shouldPostProcess whether the bean is subject for post-processing * @return mixed the object obtained from the FactoryBean - * @throws BeanCreationException if FactoryBean object creation failed + * @throws Bee_Context_BeanCreationException if FactoryBean object creation failed * @see org.springframework.beans.factory.FactoryBean#getObject() */ protected function getObjectFromFactoryBean(Bee_Context_IFactoryBean $factory, $beanName, $shouldPostProcess) { @@ -722,15 +726,16 @@ } } - /** - * Obtain an object to expose from the given FactoryBean. - * @param Bee_Context_IFactoryBean $factory the FactoryBean instance - * @param string $beanName the name of the bean - * @param boolean $shouldPostProcess whether the bean is subject for post-processing - * @return mixed the object obtained from the FactoryBean - * @throws BeanCreationException if FactoryBean object creation failed - * @see org.springframework.beans.factory.FactoryBean#getObject() - */ + /** + * Obtain an object to expose from the given FactoryBean. + * @param Bee_Context_IFactoryBean $factory the FactoryBean instance + * @param string $beanName the name of the bean + * @param boolean $shouldPostProcess whether the bean is subject for post-processing + * @throws Bee_Context_BeanCurrentlyInCreationException + * @throws Bee_Context_BeanCreationException + * @return mixed the object obtained from the FactoryBean + * @see org.springframework.beans.factory.FactoryBean#getObject() + */ private function doGetObjectFromFactoryBean(Bee_Context_IFactoryBean $factory, $beanName, $shouldPostProcess) { try { $object = $factory->getObject(); @@ -817,6 +822,9 @@ */ public function setParent(Bee_IContext $parent) { $this->parent = $parent; + if($parent instanceof Bee_Context_Config_IBeanDefinitionRegistry) { + $this->setParentRegistry($parent); + } } public function getModificationTimestamp() { Modified: trunk/framework/Bee/Context/Config/BasicBeanDefinitionRegistry.php =================================================================== --- trunk/framework/Bee/Context/Config/BasicBeanDefinitionRegistry.php 2013-11-05 23:30:23 UTC (rev 118) +++ trunk/framework/Bee/Context/Config/BasicBeanDefinitionRegistry.php 2013-11-06 01:25:35 UTC (rev 119) @@ -40,7 +40,12 @@ * @var boolean */ private $hasDestructionAwareBeanPostProcessors; - + + /** + * @var Bee_Context_Config_IBeanDefinitionRegistry + */ + private $parentRegistry; + public function containsBeanDefinition($beanName) { return array_key_exists($beanName, $this->beanDefinitions); } @@ -65,8 +70,10 @@ $this->beanDefinitions[$beanName] = $bd; } return $bd; - } + if(!is_null($this->parentRegistry)) { + return $this->parentRegistry->getBeanDefinition($beanName); + } throw new Bee_Context_NoSuchBeanDefinitionException($beanName); } @@ -187,5 +194,17 @@ return $this->beanDefinitions; } + /** + * @param \Bee_Context_Config_IBeanDefinitionRegistry $parentRegistry + */ + public function setParentRegistry(\Bee_Context_Config_IBeanDefinitionRegistry $parentRegistry) { + $this->parentRegistry = $parentRegistry; + } + + /** + * @return \Bee_Context_Config_IBeanDefinitionRegistry + */ + public function getParentRegistry() { + return $this->parentRegistry; + } } -?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-05 23:30:25
|
Revision: 118 http://sourceforge.net/p/beeframework/code/118 Author: m_plomer Date: 2013-11-05 23:30:23 +0000 (Tue, 05 Nov 2013) Log Message: ----------- tagged latest changes Added Paths: ----------- tags/0.9.12/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-05 23:29:29
|
Revision: 117 http://sourceforge.net/p/beeframework/code/117 Author: m_plomer Date: 2013-11-05 23:29:27 +0000 (Tue, 05 Nov 2013) Log Message: ----------- - refactored HandlerMapping_AnaPath / AntPathMatcher Modified Paths: -------------- trunk/framework/Bee/MVC/HandlerMapping/AntPath.php trunk/framework/Bee/Utils/AntPathMatcher.php Modified: trunk/framework/Bee/MVC/HandlerMapping/AntPath.php =================================================================== --- trunk/framework/Bee/MVC/HandlerMapping/AntPath.php 2013-11-05 21:02:34 UTC (rev 116) +++ trunk/framework/Bee/MVC/HandlerMapping/AntPath.php 2013-11-05 23:29:27 UTC (rev 117) @@ -39,22 +39,6 @@ protected function getControllerBeanName(Bee_MVC_IHttpRequest $request) { $pathInfo = $request->getPathInfo(); - $controllerBeanName = $this->getDefaultControllerBeanName(); - - if (array_key_exists($pathInfo, $this->handlerMappings)) { - // shortcut for direct path matches - $controllerBeanName = $this->handlerMappings[$pathInfo]; - } else { - $matcher = new Bee_Utils_AntPathMatcher(); - foreach($this->handlerMappings as $mapping => $handler) { - if($matcher->match($mapping, $pathInfo)) { -// if(($matcher->isPattern($mapping) && $matcher->match($mapping, $pathInfo)) || Bee_Utils_Strings::startsWith($pathInfo, $mapping)) { - $controllerBeanName = $handler; - break; - } - } - } - - return $controllerBeanName; + return Bee_Utils_AntPathMatcher::getElementByMatchingArrayKey($pathInfo, $this->handlerMappings, $this->getDefaultControllerBeanName()); } } \ No newline at end of file Modified: trunk/framework/Bee/Utils/AntPathMatcher.php =================================================================== --- trunk/framework/Bee/Utils/AntPathMatcher.php 2013-11-05 21:02:34 UTC (rev 116) +++ trunk/framework/Bee/Utils/AntPathMatcher.php 2013-11-05 23:29:27 UTC (rev 117) @@ -387,6 +387,28 @@ return $buffer; } - + + /** + * @param string $path + * @param array $array + * @param mixed $defaultValue + * @return mixed + */ + public static function getElementByMatchingArrayKey($path, array $array, $defaultValue = null) { + $result = $defaultValue; + if (array_key_exists($path, $array)) { + // shortcut for direct path matches + $result = $array[$path]; + } else { + $matcher = new Bee_Utils_AntPathMatcher(); + foreach($array as $mapping => $element) { + if($matcher->match($mapping, $path)) { +// if(($matcher->isPattern($mapping) && $matcher->match($mapping, $pathInfo)) || Bee_Utils_Strings::startsWith($pathInfo, $mapping)) { + $result = $element; + break; + } + } + } + return $result; + } } -?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-05 21:02:39
|
Revision: 116 http://sourceforge.net/p/beeframework/code/116 Author: m_plomer Date: 2013-11-05 21:02:34 +0000 (Tue, 05 Nov 2013) Log Message: ----------- tagged latest changes Added Paths: ----------- tags/0.9.11/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-05 20:58:55
|
Revision: 115 http://sourceforge.net/p/beeframework/code/115 Author: m_plomer Date: 2013-11-05 20:58:50 +0000 (Tue, 05 Nov 2013) Log Message: ----------- - Security_Helper: minor refactoring - Security_Helper: added ::getPrincipal() convenience Modified Paths: -------------- trunk/framework/Bee/Security/Helper.php Modified: trunk/framework/Bee/Security/Helper.php =================================================================== --- trunk/framework/Bee/Security/Helper.php 2013-11-05 20:48:29 UTC (rev 114) +++ trunk/framework/Bee/Security/Helper.php 2013-11-05 20:58:50 UTC (rev 115) @@ -24,47 +24,47 @@ */ class Bee_Security_Helper { - /** - * @var Bee_Security_IAccessDecisionManager - */ - private static $accessDecisionManager; + /** + * @var Bee_Security_IAccessDecisionManager + */ + private static $accessDecisionManager; - /** - * @var Bee_Security_IAfterInvocationManager - */ - private static $afterInvocationProviderManager; + /** + * @var Bee_Security_IAfterInvocationManager + */ + private static $afterInvocationProviderManager; - /** - * @var Bee_Security_IUserDetailsService - */ - private static $userDetailsService; + /** + * @var Bee_Security_IUserDetailsService + */ + private static $userDetailsService; - public static function construct(Bee_Security_IAccessDecisionManager $accessDecisionManager = null, - Bee_Security_IAfterInvocationManager $afterInvocationProviderManager = null, - Bee_Security_IUserDetailsService $userDetailsService = null) { - self::$accessDecisionManager = $accessDecisionManager; - self::$afterInvocationProviderManager = $afterInvocationProviderManager; - self::$userDetailsService = $userDetailsService; - } + public static function construct(Bee_Security_IAccessDecisionManager $accessDecisionManager = null, + Bee_Security_IAfterInvocationManager $afterInvocationProviderManager = null, + Bee_Security_IUserDetailsService $userDetailsService = null) { + self::$accessDecisionManager = $accessDecisionManager; + self::$afterInvocationProviderManager = $afterInvocationProviderManager; + self::$userDetailsService = $userDetailsService; + } /** * @return bool */ public static function isAuthenticated() { - $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); - return is_null($auth) ? false : $auth->isAuthenticated(); - } + $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); + return is_null($auth) ? false : $auth->isAuthenticated(); + } /** * @return array */ public static function getRoles() { - $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); - if(is_null($auth) || !$auth->isAuthenticated()) { - return array(); - } - return (array_keys($auth->getAuthorities())); - } + $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); + if (is_null($auth) || !$auth->isAuthenticated()) { + return array(); + } + return (array_keys($auth->getAuthorities())); + } /** * @param $role @@ -72,13 +72,12 @@ * @throws Bee_Security_Exception_Authentication */ public static function checkRole($role) { - $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); - if(is_null($auth) || !$auth->isAuthenticated()) { - throw new Bee_Security_Exception_Authentication('Not authenticated'); - } - self::$accessDecisionManager->decide($auth, null, new Bee_Security_ConfigAttributeDefinition($role)); - return true; - } + self::$accessDecisionManager->decide( + self::getAuthIfAuthenticated(), null, + new Bee_Security_ConfigAttributeDefinition($role) + ); + return true; + } /** * @param $configAttribute @@ -87,13 +86,12 @@ * @throws Bee_Security_Exception_Authentication */ public static function checkAccess($configAttribute, $secureObject = null) { - $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); - if(is_null($auth) || !$auth->isAuthenticated()) { - throw new Bee_Security_Exception_Authentication('Not authenticated'); - } - self::$accessDecisionManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute)); - return true; - } + self::$accessDecisionManager->decide( + self::getAuthIfAuthenticated(), $secureObject, + new Bee_Security_ConfigAttributeDefinition($configAttribute) + ); + return true; + } /** * @param $configAttribute @@ -103,29 +101,43 @@ * @throws Bee_Security_Exception_Authentication */ public static function checkResultAccess($configAttribute, $secureObject = null, $returnedObject = null) { - $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); - if(is_null($auth) || !$auth->isAuthenticated()) { - throw new Bee_Security_Exception_Authentication('Not authenticated'); - } - return self::$afterInvocationProviderManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute), $returnedObject); - } + return self::$afterInvocationProviderManager->decide( + self::getAuthIfAuthenticated(), $secureObject, + new Bee_Security_ConfigAttributeDefinition($configAttribute), $returnedObject + ); + } /** + * @return mixed + */ + public static function getPrincipal() { + return self::getAuthIfAuthenticated()->getPrincipal(); + } + + private static function getAuthIfAuthenticated() { + $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); + if (is_null($auth) || !$auth->isAuthenticated()) { + throw new Bee_Security_Exception_Authentication('Not authenticated'); + } + return $auth; + } + + /** * @param $identityName * @return mixed * @throws Bee_Security_Exception_Authentication */ public static function getIdentity($identityName) { - $auth = self::$userDetailsService->getGroupByName($identityName); - if ($auth instanceof Potiscom_Auth_Doctrine_Group) { - return $auth; - } - $auth = self::$userDetailsService->getUserByName($identityName); - if ($auth instanceof Potiscom_Auth_Doctrine_User) { - return $auth; - } - throw new Bee_Security_Exception_Authentication('Not authenticated'); - } + $auth = self::$userDetailsService->getGroupByName($identityName); + if ($auth instanceof Potiscom_Auth_Doctrine_Group) { + return $auth; + } + $auth = self::$userDetailsService->getUserByName($identityName); + if ($auth instanceof Potiscom_Auth_Doctrine_User) { + return $auth; + } + throw new Bee_Security_Exception_Authentication('Not authenticated'); + } /** * @param $identityName @@ -134,11 +146,11 @@ * @return bool */ public static function checkAccessForIdentity($identityName, $configAttribute, $secureObject = null) { - $identity = self::getIdentity($identityName); - $auth = new Bee_Security_UsernamePasswordAuthenticationToken($username, $password); - self::$accessDecisionManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute)); - return true; - } + $identity = self::getIdentity($identityName); + $auth = new Bee_Security_UsernamePasswordAuthenticationToken($username, $password); + self::$accessDecisionManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute)); + return true; + } /** * @param $identityName @@ -148,11 +160,13 @@ * @return mixed */ public static function checkResultAccessForIdentity($identityName, $configAttribute, $secureObject = null, $returnedObject = null) { - $auth = self::getIdentity($identityName); - return self::$afterInvocationProviderManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute), $returnedObject); - } + $auth = self::getIdentity($identityName); + return self::$afterInvocationProviderManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute), $returnedObject); + } } -class SEC extends Bee_Security_Helper {} +class SEC extends Bee_Security_Helper { +} + ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-05 20:48:32
|
Revision: 114 http://sourceforge.net/p/beeframework/code/114 Author: m_plomer Date: 2013-11-05 20:48:29 +0000 (Tue, 05 Nov 2013) Log Message: ----------- - Security_Helper: fixed wrong return value type in ::isAuthenticated() - Security_Helper: added PHPDoc stubs Modified Paths: -------------- trunk/framework/Bee/Security/Helper.php Modified: trunk/framework/Bee/Security/Helper.php =================================================================== --- trunk/framework/Bee/Security/Helper.php 2013-11-05 18:50:39 UTC (rev 113) +++ trunk/framework/Bee/Security/Helper.php 2013-11-05 20:48:29 UTC (rev 114) @@ -47,15 +47,18 @@ self::$userDetailsService = $userDetailsService; } - public static function isAuthenticated() { + /** + * @return bool + */ + public static function isAuthenticated() { $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); - if(is_null($auth) || !$auth->isAuthenticated()) { - return array(); - } - return $auth->isAuthenticated(); + return is_null($auth) ? false : $auth->isAuthenticated(); } - public static function getRoles() { + /** + * @return array + */ + public static function getRoles() { $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); if(is_null($auth) || !$auth->isAuthenticated()) { return array(); @@ -63,7 +66,12 @@ return (array_keys($auth->getAuthorities())); } - public static function checkRole($role) { + /** + * @param $role + * @return bool + * @throws Bee_Security_Exception_Authentication + */ + public static function checkRole($role) { $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); if(is_null($auth) || !$auth->isAuthenticated()) { throw new Bee_Security_Exception_Authentication('Not authenticated'); @@ -72,7 +80,13 @@ return true; } - public static function checkAccess($configAttribute, $secureObject = null) { + /** + * @param $configAttribute + * @param null $secureObject + * @return bool + * @throws Bee_Security_Exception_Authentication + */ + public static function checkAccess($configAttribute, $secureObject = null) { $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); if(is_null($auth) || !$auth->isAuthenticated()) { throw new Bee_Security_Exception_Authentication('Not authenticated'); @@ -81,7 +95,14 @@ return true; } - public static function checkResultAccess($configAttribute, $secureObject = null, $returnedObject = null) { + /** + * @param $configAttribute + * @param null $secureObject + * @param null $returnedObject + * @return mixed + * @throws Bee_Security_Exception_Authentication + */ + public static function checkResultAccess($configAttribute, $secureObject = null, $returnedObject = null) { $auth = Bee_Security_Context_Holder::getContext()->getAuthentication(); if(is_null($auth) || !$auth->isAuthenticated()) { throw new Bee_Security_Exception_Authentication('Not authenticated'); @@ -89,7 +110,12 @@ return self::$afterInvocationProviderManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute), $returnedObject); } - public static function getIdentity($identityName) { + /** + * @param $identityName + * @return mixed + * @throws Bee_Security_Exception_Authentication + */ + public static function getIdentity($identityName) { $auth = self::$userDetailsService->getGroupByName($identityName); if ($auth instanceof Potiscom_Auth_Doctrine_Group) { return $auth; @@ -101,14 +127,27 @@ throw new Bee_Security_Exception_Authentication('Not authenticated'); } - public static function checkAccessForIdentity($identityName, $configAttribute, $secureObject = null) { + /** + * @param $identityName + * @param $configAttribute + * @param null $secureObject + * @return bool + */ + public static function checkAccessForIdentity($identityName, $configAttribute, $secureObject = null) { $identity = self::getIdentity($identityName); $auth = new Bee_Security_UsernamePasswordAuthenticationToken($username, $password); self::$accessDecisionManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute)); return true; } - public static function checkResultAccessForIdentity($identityName, $configAttribute, $secureObject = null, $returnedObject = null) { + /** + * @param $identityName + * @param $configAttribute + * @param null $secureObject + * @param null $returnedObject + * @return mixed + */ + public static function checkResultAccessForIdentity($identityName, $configAttribute, $secureObject = null, $returnedObject = null) { $auth = self::getIdentity($identityName); return self::$afterInvocationProviderManager->decide($auth, $secureObject, new Bee_Security_ConfigAttributeDefinition($configAttribute), $returnedObject); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-05 18:50:41
|
Revision: 113 http://sourceforge.net/p/beeframework/code/113 Author: m_plomer Date: 2013-11-05 18:50:39 +0000 (Tue, 05 Nov 2013) Log Message: ----------- - minor optimizations in AntPath handler mapping Modified Paths: -------------- trunk/framework/Bee/MVC/HandlerMapping/Abstract.php trunk/framework/Bee/MVC/HandlerMapping/AntPath.php Modified: trunk/framework/Bee/MVC/HandlerMapping/Abstract.php =================================================================== --- trunk/framework/Bee/MVC/HandlerMapping/Abstract.php 2013-11-04 16:40:57 UTC (rev 112) +++ trunk/framework/Bee/MVC/HandlerMapping/Abstract.php 2013-11-05 18:50:39 UTC (rev 113) @@ -22,36 +22,32 @@ * @author Michael Plomer <mic...@it...> */ abstract class Bee_MVC_HandlerMapping_Abstract implements Bee_MVC_IHandlerMapping, Bee_Context_Config_IContextAware { - + /** * Enter description here... * * @var Bee_IContext */ private $context; - - + /** * Enter description here... * * @var Bee_IContext */ private $defaultControllerBeanName; - - + /** * Enter description here... * * @var array */ private $interceptors = array(); - public function setBeeContext(Bee_IContext $context) { $this->context = $context; } - /** * Enter description here... * @@ -60,8 +56,7 @@ public function getDefaultControllerBeanName() { return $this->defaultControllerBeanName; } - - + /** * Enter description here... * @@ -72,7 +67,6 @@ $this->defaultControllerBeanName = $defaultControllerBeanName; } - /** * Enter description here... * @@ -81,8 +75,7 @@ public function setInterceptors(array $interceptors) { $this->interceptors = $interceptors; } - - + /** * Enter description here... * @@ -91,29 +84,21 @@ public function getInterceptors() { return $this->interceptors; } - - - + public function getHandler(Bee_MVC_IHttpRequest $request) { - $controllerBeanName = $this->getControllerBeanName($request); - if(is_string($controllerBeanName)) { - $handlerBean = $this->context->getBean($controllerBeanName, 'Bee_MVC_IController'); - } else if($controllerBeanName instanceof Bee_MVC_IController) { - $handlerBean = $controllerBeanName; - } + $handlerBean = is_string($controllerBeanName) ? + $handlerBean = $this->context->getBean($controllerBeanName, 'Bee_MVC_IController') : + $controllerBeanName; - if(is_null($handlerBean)) { + if (!$handlerBean instanceof Bee_MVC_IController) { throw new Exception('Error retrieving handler bean: must be a valid bean name or Bee_MVC_IController instance'); } $hec = new Bee_MVC_HandlerExecutionChain($handlerBean); $hec->addInterceptors($this->interceptors); - return $hec; } - protected abstract function getControllerBeanName(Bee_MVC_IHttpRequest $request); -} -?> \ No newline at end of file +} \ No newline at end of file Modified: trunk/framework/Bee/MVC/HandlerMapping/AntPath.php =================================================================== --- trunk/framework/Bee/MVC/HandlerMapping/AntPath.php 2013-11-04 16:40:57 UTC (rev 112) +++ trunk/framework/Bee/MVC/HandlerMapping/AntPath.php 2013-11-05 18:50:39 UTC (rev 113) @@ -38,16 +38,14 @@ } protected function getControllerBeanName(Bee_MVC_IHttpRequest $request) { - $matcher = new Bee_Utils_AntPathMatcher(); -// $pathInfo = Bee_Utils_Env::getPathInfo(); $pathInfo = $request->getPathInfo(); - $controllerBeanName = $this->getDefaultControllerBeanName(); if (array_key_exists($pathInfo, $this->handlerMappings)) { // shortcut for direct path matches $controllerBeanName = $this->handlerMappings[$pathInfo]; } else { + $matcher = new Bee_Utils_AntPathMatcher(); foreach($this->handlerMappings as $mapping => $handler) { if($matcher->match($mapping, $pathInfo)) { // if(($matcher->isPattern($mapping) && $matcher->match($mapping, $pathInfo)) || Bee_Utils_Strings::startsWith($pathInfo, $mapping)) { @@ -59,5 +57,4 @@ return $controllerBeanName; } -} -?> \ No newline at end of file +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-04 16:41:00
|
Revision: 112 http://sourceforge.net/p/beeframework/code/112 Author: m_plomer Date: 2013-11-04 16:40:57 +0000 (Mon, 04 Nov 2013) Log Message: ----------- tagged latest changes Added Paths: ----------- tags/0.9.10/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-04 16:40:08
|
Revision: 111 http://sourceforge.net/p/beeframework/code/111 Author: m_plomer Date: 2013-11-04 16:40:05 +0000 (Mon, 04 Nov 2013) Log Message: ----------- - SimpleUser: extracted SimpleUserBase to facilitate sub-classing Modified Paths: -------------- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php 2013-11-04 16:39:45 UTC (rev 110) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php 2013-11-04 16:40:05 UTC (rev 111) @@ -1,7 +1,5 @@ <?php namespace Bee\Security\UserDetails\Doctrine2; -use Bee_Security_IGrantedAuthority; -use Bee_Security_IUserDetails; /** * Simple user entity class This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-04 16:39:47
|
Revision: 110 http://sourceforge.net/p/beeframework/code/110 Author: m_plomer Date: 2013-11-04 16:39:45 +0000 (Mon, 04 Nov 2013) Log Message: ----------- - SimpleUser: extracted SimpleUserBase to facilitate sub-classing Modified Paths: -------------- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php Added Paths: ----------- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserBase.php Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php 2013-11-04 15:24:57 UTC (rev 109) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php 2013-11-04 16:39:45 UTC (rev 110) @@ -4,58 +4,12 @@ use Bee_Security_IUserDetails; /** - * Base class for user entities - also usable as simple user entity (WIP) + * Simple user entity class * @package Bee\Security\UserDetails\Doctrine2 * @Entity * @Table(name="bee_security_user") */ -class SimpleUser extends UserBase { - - /** - * @var array - * @Column(name="roles", type="simple_array", nullable=true) - */ - protected $roles = array(); - - /** - * @var null|array - */ - private $rolesTransformed = null; - - /** - * Returns the authorities granted to the user. Cannot return <code>null</code>. - * - * @return Bee_Security_IGrantedAuthority[] the authorities, sorted by natural key (never <code>null</code>) - */ - public function getAuthorities() { - if(!$this->rolesTransformed) { - $this->rolesTransformed = array_fill_keys($this->roles, true); - } - return $this->rolesTransformed; - } - - /** - * @param string $role - */ - public function addRole($role) { - $this->getAuthorities(); - $this->rolesTransformed[$role] = true; - $this->updateRoles(); - } - - public function removeRole($role) { - $this->getAuthorities(); - unset($this->rolesTransformed[$role]); - $this->updateRoles(); - } - - public function hasRole($role) { - return array_key_exists($role, $this->getAuthorities()); - } - - private function updateRoles() { - $this->roles = array_keys($this->rolesTransformed); - } +class SimpleUser extends SimpleUserBase { } Added: trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserBase.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserBase.php (rev 0) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserBase.php 2013-11-04 16:39:45 UTC (rev 110) @@ -0,0 +1,58 @@ +<?php +namespace Bee\Security\UserDetails\Doctrine2; +use \Bee_Security_IGrantedAuthority; + + +/** + * Base class for user entities + * @package Bee\Security\UserDetails\Doctrine2 + * @MappedSuperclass + */ +class SimpleUserBase extends UserBase { + /** + * @var array + * @Column(name="roles", type="simple_array", nullable=true) + */ + protected $roles = array(); + + /** + * @var null|array + */ + private $rolesTransformed = null; + + /** + * Returns the authorities granted to the user. Cannot return <code>null</code>. + * + * @return Bee_Security_IGrantedAuthority[] the authorities, sorted by natural key (never <code>null</code>) + */ + public function getAuthorities() { + if(!$this->rolesTransformed) { + $this->rolesTransformed = array_fill_keys($this->roles, true); + } + return $this->rolesTransformed; + } + + /** + * @param string $role + */ + public function addRole($role) { + $this->getAuthorities(); + $this->rolesTransformed[$role] = true; + $this->updateRoles(); + } + + public function removeRole($role) { + $this->getAuthorities(); + unset($this->rolesTransformed[$role]); + $this->updateRoles(); + } + + public function hasRole($role) { + return array_key_exists($role, $this->getAuthorities()); + } + + private function updateRoles() { + $this->roles = array_keys($this->rolesTransformed); + } + +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-04 15:25:02
|
Revision: 109 http://sourceforge.net/p/beeframework/code/109 Author: m_plomer Date: 2013-11-04 15:24:57 +0000 (Mon, 04 Nov 2013) Log Message: ----------- - tagged latest changes Added Paths: ----------- tags/0.9.9/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-04 15:24:05
|
Revision: 108 http://sourceforge.net/p/beeframework/code/108 Author: m_plomer Date: 2013-11-04 15:24:00 +0000 (Mon, 04 Nov 2013) Log Message: ----------- - SimpleUser / UserBase : made most properties protected so their mappings can be overridden in subclasses Modified Paths: -------------- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php 2013-11-03 13:36:43 UTC (rev 107) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php 2013-11-04 15:24:00 UTC (rev 108) @@ -15,7 +15,7 @@ * @var array * @Column(name="roles", type="simple_array", nullable=true) */ - private $roles = array(); + protected $roles = array(); /** * @var null|array Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php 2013-11-03 13:36:43 UTC (rev 107) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php 2013-11-04 15:24:00 UTC (rev 108) @@ -36,13 +36,13 @@ * @var boolean * @Column(name="disabled", type="boolean", nullable=false) */ - private $disabled = false; + protected $disabled = false; /** * @var string * @Column(name="name", type="string", length=200, nullable=true) */ - private $name; + protected $name; /** * Get the identifier This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-03 13:36:47
|
Revision: 107 http://sourceforge.net/p/beeframework/code/107 Author: m_plomer Date: 2013-11-03 13:36:43 +0000 (Sun, 03 Nov 2013) Log Message: ----------- - tagged latest changes Added Paths: ----------- tags/0.9.8/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-11-03 13:36:02
|
Revision: 106 http://sourceforge.net/p/beeframework/code/106 Author: m_plomer Date: 2013-11-03 13:36:00 +0000 (Sun, 03 Nov 2013) Log Message: ----------- - use filter_var(VALIDATE_BOOLEAN) for boolean attributes in ParserDelegate - fixed array merging to consider both the type of the current array and that of the parent Modified Paths: -------------- trunk/framework/Bee/Context/Config/ArrayValue.php trunk/framework/Bee/Context/Xml/ParserDelegate.php Modified: trunk/framework/Bee/Context/Config/ArrayValue.php =================================================================== --- trunk/framework/Bee/Context/Config/ArrayValue.php 2013-10-31 11:38:34 UTC (rev 105) +++ trunk/framework/Bee/Context/Config/ArrayValue.php 2013-11-03 13:36:00 UTC (rev 106) @@ -82,8 +82,9 @@ function merge(Traversable $parent) { $tmpArray = array(); + $parentAssoc = $parent instanceof Bee_Context_Config_ArrayValue && $parent->associative; foreach ($parent as $key => $value) { - if($this->associative) { + if($parentAssoc) { $tmpArray[$key] = $value; } else { array_push($tmpArray, $value); Modified: trunk/framework/Bee/Context/Xml/ParserDelegate.php =================================================================== --- trunk/framework/Bee/Context/Xml/ParserDelegate.php 2013-10-31 11:38:34 UTC (rev 105) +++ trunk/framework/Bee/Context/Xml/ParserDelegate.php 2013-11-03 13:36:00 UTC (rev 106) @@ -31,8 +31,6 @@ */ const BEANS_NAMESPACE_URI = 'http://www.beeframework.org/schema/beans'; - const TRUE_VALUE = 'true'; - const DEFAULT_VALUE = 'default'; const BEAN_ELEMENT = 'bean'; @@ -129,7 +127,7 @@ public function initDefaults(DOMElement $root) { $defaults = new Bee_Context_Xml_DocumentDefaultsDefinition(); - $defaults->setMerge($root->getAttribute(self::DEFAULT_MERGE_ATTRIBUTE) === self::TRUE_VALUE); + $defaults->setMerge(filter_var($root->getAttribute(self::DEFAULT_MERGE_ATTRIBUTE), FILTER_VALIDATE_BOOLEAN)); if($root->hasAttribute(self::DEFAULT_INIT_METHOD_ATTRIBUTE)) { $defaults->setInitMethod($root->getAttribute(self::DEFAULT_INIT_METHOD_ATTRIBUTE)); } @@ -234,7 +232,7 @@ Bee_Context_Xml_Utils::parseScopeAttribute($ele, $bd, $containingBd); if ($ele->hasAttribute(self::ABSTRACT_ATTRIBUTE)) { - $bd->setAbstract(self::TRUE_VALUE === $ele->getAttribute(self::ABSTRACT_ATTRIBUTE)); + $bd->setAbstract(filter_var($ele->getAttribute(self::ABSTRACT_ATTRIBUTE), FILTER_VALIDATE_BOOLEAN)); } Bee_context_Xml_Utils::parseDependsOnAttribute($ele, $bd); @@ -654,7 +652,7 @@ if($collectionElement->hasAttribute(self::MERGE_ATTRIBUTE)) { $value = $collectionElement->getAttribute(self::MERGE_ATTRIBUTE); if (self::DEFAULT_VALUE !== $value) { - return self::TRUE_VALUE === $value; + return filter_var($value, FILTER_VALIDATE_BOOLEAN); } } return $this->defaults->getMerge(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-10-31 11:38:38
|
Revision: 105 http://sourceforge.net/p/beeframework/code/105 Author: m_plomer Date: 2013-10-31 11:38:34 +0000 (Thu, 31 Oct 2013) Log Message: ----------- - tagged latest change Added Paths: ----------- tags/0.9.7/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-10-31 11:37:38
|
Revision: 104 http://sourceforge.net/p/beeframework/code/104 Author: m_plomer Date: 2013-10-31 11:37:35 +0000 (Thu, 31 Oct 2013) Log Message: ----------- - PhpMailerWrapper : added ccRecipients property Modified Paths: -------------- trunk/framework/Bee/Utils/PhpMailerWrapper.php Modified: trunk/framework/Bee/Utils/PhpMailerWrapper.php =================================================================== --- trunk/framework/Bee/Utils/PhpMailerWrapper.php 2013-10-15 17:29:38 UTC (rev 103) +++ trunk/framework/Bee/Utils/PhpMailerWrapper.php 2013-10-31 11:37:35 UTC (rev 104) @@ -76,6 +76,11 @@ private $mailType = 'mail'; /** + * @var array + */ + private $ccRecipients = array(); + + /** * Enter description here... * * @return string @@ -264,6 +269,20 @@ $this->mailType = $mailType; } + /** + * @param array $ccRecipients + */ + public function setCcRecipients(array $ccRecipients) { + $this->ccRecipients = $ccRecipients; + } + + /** + * @return array + */ + public function getCcRecipients() { + return $this->ccRecipients; + } + protected function createMailer($sender, $recipient, $charSet = 'UTF-8', $html = true) { $phpMailer = new PHPMailer(true); $phpMailer->CharSet = $charSet; @@ -319,6 +338,9 @@ throw new Exception('SmartyMailer failed: mailformed recipient. Type-mismatch. Recipient must be either string or array, but is: "' . gettype($recipient) . '" instead.'); } + foreach($this->ccRecipients as $ccRec) { + $phpMailer->addCC($ccRec); + } // SET SENDER if (!$sender) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-10-15 17:29:42
|
Revision: 103 http://sourceforge.net/p/beeframework/code/103 Author: m_plomer Date: 2013-10-15 17:29:38 +0000 (Tue, 15 Oct 2013) Log Message: ----------- Added Paths: ----------- tags/0.9.6/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-10-15 17:28:57
|
Revision: 102 http://sourceforge.net/p/beeframework/code/102 Author: m_plomer Date: 2013-10-15 17:28:55 +0000 (Tue, 15 Oct 2013) Log Message: ----------- - extracted PhpMailerWrapper base class out of SmartyMailer as a base class for PHPMailer based classes - added smarty and phpmailer as require-dev dependencies Modified Paths: -------------- trunk/framework/Bee/Utils/PhpMailerWrapper.php Modified: trunk/framework/Bee/Utils/PhpMailerWrapper.php =================================================================== --- trunk/framework/Bee/Utils/PhpMailerWrapper.php 2013-10-15 17:19:03 UTC (rev 101) +++ trunk/framework/Bee/Utils/PhpMailerWrapper.php 2013-10-15 17:28:55 UTC (rev 102) @@ -295,7 +295,7 @@ // SET RECIPIENT - if (is_null($recipient)) { + if (!$recipient) { $recipient = array(); $recipient['address'] = $this->getDefaultRecipientAddress(); $recipient['name'] = $this->getDefaultRecipientName(); @@ -321,7 +321,7 @@ // SET SENDER - if (is_null($sender)) { + if (!$sender) { $sender = array(); $sender['address'] = $this->getDefaultSenderAddress(); $sender['name'] = $this->getDefaultSenderName(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-10-15 17:19:07
|
Revision: 101 http://sourceforge.net/p/beeframework/code/101 Author: m_plomer Date: 2013-10-15 17:19:03 +0000 (Tue, 15 Oct 2013) Log Message: ----------- Added Paths: ----------- tags/0.9.5/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-10-15 17:17:25
|
Revision: 100 http://sourceforge.net/p/beeframework/code/100 Author: m_plomer Date: 2013-10-15 17:17:20 +0000 (Tue, 15 Oct 2013) Log Message: ----------- - extracted PhpMailerWrapper base class out of SmartyMailer as a base class for PHPMailer based classes - added smarty and phpmailer as require-dev dependencies Modified Paths: -------------- trunk/composer.json trunk/framework/Bee/Utils/SmartyMailer.php Added Paths: ----------- trunk/framework/Bee/Utils/PhpMailerWrapper.php Modified: trunk/composer.json =================================================================== --- trunk/composer.json 2013-09-30 20:49:26 UTC (rev 99) +++ trunk/composer.json 2013-10-15 17:17:20 UTC (rev 100) @@ -21,6 +21,10 @@ "niktux/addendum": "0.4.1", "apache/log4php": "~2.3@stable" }, + "require-dev": { + "smarty/smarty": "~3.1@stable", + "phpmailer/phpmailer": "~5@stable" + }, "minimum-stability": "RC", "autoload": { "psr-0": { Added: trunk/framework/Bee/Utils/PhpMailerWrapper.php =================================================================== --- trunk/framework/Bee/Utils/PhpMailerWrapper.php (rev 0) +++ trunk/framework/Bee/Utils/PhpMailerWrapper.php 2013-10-15 17:17:20 UTC (rev 100) @@ -0,0 +1,350 @@ +<?php + +namespace Bee\Utils; + +use Bee_Utils_Strings; +use Exception; +use PHPMailer; + + +/** + * Class PhpMailerWrapper + * @package Bee\Utils + */ +class PhpMailerWrapper { + + /** + * Enter description here... + * + * @var string + */ + private $smtpHost; + + /** + * Enter description here... + * + * @var int + */ + private $smtpPort = 25; + + /** + * Enter description here... + * + * @var string + */ + private $smtpUsername; + + /** + * Enter description here... + * + * @var string + */ + private $smtpPassword; + + /** + * @var string + */ + private $smtpSecurity; + + /** + * Enter description here... + * + * @var string + */ + private $defaultSenderAddress; + + /** + * Enter description here... + * + * @var string + */ + private $defaultSenderName; + + /** + * @var string + */ + private $defaultRecipientAddress; + + /** + * @var string + */ + private $defaultRecipientName; + + /** + * @var string + */ + private $mailType = 'mail'; + + /** + * Enter description here... + * + * @return string + */ + public final function getSmtpHost() { + return $this->smtpHost; + } + + /** + * Enter description here... + * + * @param string $smtpHost + * @return void + */ + public final function setSmtpHost($smtpHost) { + $this->smtpHost = $smtpHost; + } + + /** + * Gets the SmtpPort + * + * @return int $smtpPort + */ + public function getSmtpPort() { + return $this->smtpPort; + } + + /** + * Sets the SmtpPort + * + * @param int $smtpPort + * @return void + */ + public function setSmtpPort($smtpPort) { + $this->smtpPort = $smtpPort; + } + + /** + * Enter description here... + * + * @return string + */ + public final function getSmtpUsername() { + return $this->smtpUsername; + } + + /** + * Enter description here... + * + * @param string $smtpUsername + * @return void + */ + public final function setSmtpUsername($smtpUsername) { + $this->smtpUsername = $smtpUsername; + } + + /** + * Gets the SmtpPassword + * + * @return string $smtpPassword + */ + public function getSmtpPassword() { + return $this->smtpPassword; + } + + /** + * Sets the SmtpPassword + * + * @param string $smtpPassword + * @return void + */ + public function setSmtpPassword($smtpPassword) { + $this->smtpPassword = $smtpPassword; + } + + /** + * Gets the SmtpSecurity + * + * @return string $smtpSecurity + */ + public function getSmtpSecurity() { + return $this->smtpSecurity; + } + + /** + * Sets the SmtpSecurity + * + * @param string $smtpSecurity + * @return void + */ + public function setSmtpSecurity($smtpSecurity) { + $this->smtpSecurity = $smtpSecurity; + } + + /** + * Enter description here... + * + * @return string + */ + public final function getDefaultSenderAddress() { + return $this->defaultSenderAddress; + } + + /** + * Enter description here... + * + * @param string $defaultSenderAddress + */ + public final function setDefaultSenderAddress($defaultSenderAddress) { + $this->defaultSenderAddress = $defaultSenderAddress; + } + + /** + * Enter description here... + * + * @return string + */ + public final function getDefaultSenderName() { + return $this->defaultSenderName; + } + + /** + * Enter description here... + * + * @param string $defaultSenderName + * @return void + */ + public final function setDefaultSenderName($defaultSenderName) { + $this->defaultSenderName = $defaultSenderName; + } + + /** + * Gets the DefaultRecipientAddress + * + * @return string $defaultRecipientAddress + */ + public function getDefaultRecipientAddress() { + return $this->defaultRecipientAddress; + } + + /** + * Sets the DefaultRecipientAddress + * + * @param string $defaultRecipientAddress + * @return void + */ + public function setDefaultRecipientAddress($defaultRecipientAddress) { + $this->defaultRecipientAddress = $defaultRecipientAddress; + } + + /** + * Gets the DefaultRecipientName + * + * @return string $defaultRecipientName + */ + public function getDefaultRecipientName() { + return $this->defaultRecipientName; + } + + /** + * Sets the DefaultRecipientName + * + * @param string $defaultRecipientName + * @return void + */ + public function setDefaultRecipientName($defaultRecipientName) { + $this->defaultRecipientName = $defaultRecipientName; + } + + /** + * Gets the MailType + * + * @return string $mailType + */ + public function getMailType() { + return $this->mailType; + } + + /** + * Sets the MailType + * + * @param string $mailType + * @return void + */ + public function setMailType($mailType) { + $this->mailType = $mailType; + } + + protected function createMailer($sender, $recipient, $charSet = 'UTF-8', $html = true) { + $phpMailer = new PHPMailer(true); + $phpMailer->CharSet = $charSet; + $phpMailer->IsHTML($html); + + // SET CONNECTION + switch ($this->getMailType()) { + case 'smtp' : + $phpMailer->IsSMTP(); + $phpMailer->Host = $this->getSmtpHost(); + $phpMailer->Port = intval($this->getSmtpPort()); + + if (Bee_Utils_Strings::hasText($this->getSmtpUsername())) { + $phpMailer->SMTPAuth = true; + $phpMailer->Username = $this->getSmtpUsername(); + $phpMailer->Password = $this->getSmtpPassword(); + + if (Bee_Utils_Strings::hasText($this->getSmtpSecurity())) { + $phpMailer->SMTPSecure = $this->getSmtpSecurity(); + } + } else { + } + break; + + case 'mail' : + $phpMailer->IsMail(); + break; + } + + + // SET RECIPIENT + if (is_null($recipient)) { + $recipient = array(); + $recipient['address'] = $this->getDefaultRecipientAddress(); + $recipient['name'] = $this->getDefaultRecipientName(); + } + + if (is_string($recipient)) { + $phpMailer->AddAddress($recipient); + + } else if (is_array($recipient)) { + if (!array_key_exists('address', $recipient)) { + throw new Exception('SmartyMailer failed: mailformed recipient. Field not found: "address"'); + } + + if (array_key_exists('name', $recipient)) { + $phpMailer->AddAddress($recipient['address'], $recipient['name']); + } else { + $phpMailer->AddAddress($recipient['address'], $recipient['name']); + } + + } else { + throw new Exception('SmartyMailer failed: mailformed recipient. Type-mismatch. Recipient must be either string or array, but is: "' . gettype($recipient) . '" instead.'); + } + + + // SET SENDER + if (is_null($sender)) { + $sender = array(); + $sender['address'] = $this->getDefaultSenderAddress(); + $sender['name'] = $this->getDefaultSenderName(); + } + + if (is_string($sender)) { + $phpMailer->SetFrom($sender); + + } else if (is_array($sender)) { + if (!array_key_exists('address', $sender)) { + throw new Exception('SmartyMailer failed: mailformed sender. Field not found: "address"'); + } + + if (array_key_exists('name', $sender)) { + $phpMailer->SetFrom($sender['address'], $sender['name']); + } else { + $phpMailer->SetFrom($sender['address'], $sender['name']); + } + + } else { + throw new Exception('SmartyMailer failed: mailformed sender. Type-mismatch. Sender must be either string or array, but is: "' . gettype($sender) . '" instead.'); + } + + return $phpMailer; + } +} \ No newline at end of file Modified: trunk/framework/Bee/Utils/SmartyMailer.php =================================================================== --- trunk/framework/Bee/Utils/SmartyMailer.php 2013-09-30 20:49:26 UTC (rev 99) +++ trunk/framework/Bee/Utils/SmartyMailer.php 2013-10-15 17:17:20 UTC (rev 100) @@ -14,12 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +use Bee\Utils\PhpMailerWrapper; /** * @throws Exception * */ -class Bee_Utils_SmartyMailer { +class Bee_Utils_SmartyMailer extends PhpMailerWrapper { private $pluginDir; @@ -29,68 +30,7 @@ */ private $smarty; - /** - * Enter description here... - * - * @var String - */ - private $smtpHost; - - /** - * Enter description here... - * - * @var String - */ - private $smtpPort = 25; - - /** - * Enter description here... - * - * @var String - */ - private $smtpUsername; - - /** - * Enter description here... - * - * @var String - */ - private $smtpPassword; - /** - * @var string - */ - private $smtpSecurity; - - /** - * Enter description here... - * - * @var String - */ - private $defaultSenderAddress; - - /** - * Enter description here... - * - * @var String - */ - private $defaultSenderName; - - /** - * @var string - */ - private $defaultRecipientAddress; - - /** - * @var string - */ - private $defaultRecipientName; - - - private $mailType = 'mail'; - - - /** * @param $subjectTemplate * @param $bodyTemplate * @param array $model @@ -136,99 +76,19 @@ } - /** - * @param $subjectTemplate - * @param $bodyTemplate - * @param array $model - * @param mixed $recipient Either string ex...@ma... or array with keys "address" and optional "name" - * @param mixed $sender Either string ex...@ma... or array with keys "address" and optional "name" - * - * @return PHPMailer - */ + /** + * @param $subjectTemplate + * @param $bodyTemplate + * @param array $model + * @param mixed $recipient Either string ex...@ma... or array with keys "address" and optional "name" + * @param mixed $sender Either string ex...@ma... or array with keys "address" and optional "name" + * + * @throws Exception + * @return \PHPMailer + */ public function instantiatePhpMailer($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) { - $phpMailer = new PHPMailer(true); - $phpMailer->PluginDir = $this->getPluginDir(); - $phpMailer->CharSet = 'UTF-8'; - $phpMailer->IsHTML(true); + $phpMailer = $this->createMailer($sender, $recipient); - - // SET CONNECTION - switch ($this->getMailType()) { - case 'smtp' : - $phpMailer->IsSMTP(); - $phpMailer->Host = $this->getSmtpHost(); - $phpMailer->Port = intval($this->getSmtpPort()); - - if (Bee_Utils_Strings::hasText($this->getSmtpUsername())) { - $phpMailer->SMTPAuth = true; - $phpMailer->Username = $this->getSmtpUsername(); - $phpMailer->Password = $this->getSmtpPassword(); - - if (Bee_Utils_Strings::hasText($this->getSmtpSecurity())) { - $phpMailer->SMTPSecure = $this->getSmtpSecurity(); - } - } else { - } - break; - - case 'mail' : - $phpMailer->IsMail(); - break; - } - - - // SET RECIPIENT - if (is_null($recipient)) { - $recipient = array(); - $recipient['address'] = $this->getDefaultRecipientAddress(); - $recipient['name'] = $this->getDefaultRecipientName(); - } - - if (is_string($recipient)) { - $phpMailer->AddAddress($recipient); - - } else if (is_array($recipient)) { - if (!array_key_exists('address', $recipient)) { - throw new Exception('SmartyMailer failed: mailformed recipient. Field not found: "address"'); - } - - if (array_key_exists('name', $recipient)) { - $phpMailer->AddAddress($recipient['address'], $recipient['name']); - } else { - $phpMailer->AddAddress($recipient['address'], $recipient['name']); - } - - } else { - throw new Exception('SmartyMailer failed: mailformed recipient. Type-mismatch. Recipient must be either string or array, but is: "'.gettype($recipient).'" instead.'); - } - - - // SET SENDER - if (is_null($sender)) { - $sender = array(); - $sender['address'] = $this->getDefaultSenderAddress(); - $sender['name'] = $this->getDefaultSenderName(); - } - - if (is_string($sender)) { - $phpMailer->SetFrom($sender); - - } else if (is_array($sender)) { - if (!array_key_exists('address', $sender)) { - throw new Exception('SmartyMailer failed: mailformed sender. Field not found: "address"'); - } - - if (array_key_exists('name', $sender)) { - $phpMailer->SetFrom($sender['address'], $sender['name']); - } else { - $phpMailer->SetFrom($sender['address'], $sender['name']); - } - - } else { - throw new Exception('SmartyMailer failed: mailformed sender. Type-mismatch. Sender must be either string or array, but is: "'.gettype($sender).'" instead.'); - } - - // SET CONTENT $this->smarty->clearAllAssign(); foreach($model as $key => $value) { @@ -240,8 +100,6 @@ return $phpMailer; } - - //=== GETTERS & SETTERS ============================================================================================ /** * Gets the PluginDir @@ -278,194 +136,4 @@ public final function setSmarty(Smarty $smarty) { $this->smarty = $smarty; } - - /** - * Enter description here... - * - * @return String - */ - public final function getSmtpHost() { - return $this->smtpHost; - } - - /** - * Enter description here... - * - * @param String $smtpHost - * @return void - */ - public final function setSmtpHost($smtpHost) { - $this->smtpHost = $smtpHost; - } - - /** - * Gets the SmtpPort - * - * @return $smtpPort - */ - public function getSmtpPort() { - return $this->smtpPort; - } - - /** - * Sets the SmtpPort - * - * @param $smtpPort - * @return void - */ - public function setSmtpPort($smtpPort) { - $this->smtpPort = $smtpPort; - } - - /** - * Enter description here... - * - * @return String - */ - public final function getDefaultSenderAddress() { - return $this->defaultSenderAddress; - } - - /** - * Enter description here... - * - * @param String $defaultSenderAddress - */ - public final function setDefaultSenderAddress($defaultSenderAddress) { - $this->defaultSenderAddress = $defaultSenderAddress; - } - - /** - * Enter description here... - * - * @return String - */ - public final function getDefaultSenderName() { - return $this->defaultSenderName; - } - - /** - * Enter description here... - * - * @param String $defaultSenderName - * @return void - */ - public final function setDefaultSenderName($defaultSenderName) { - $this->defaultSenderName = $defaultSenderName; - } - - /** - * Enter description here... - * - * @return String - */ - public final function getSmtpUsername() { - return $this->smtpUsername; - } - - /** - * Enter description here... - * - * @param String $smtpUsername - * @return void - */ - public final function setSmtpUsername($smtpUsername) { - $this->smtpUsername = $smtpUsername; - } - - /** - * Gets the SmtpPassword - * - * @return $smtpPassword - */ - public function getSmtpPassword() { - return $this->smtpPassword; - } - - /** - * Sets the SmtpPassword - * - * @param $smtpPassword - * @return void - */ - public function setSmtpPassword($smtpPassword) { - $this->smtpPassword = $smtpPassword; - } - - /** - * Gets the SmtpSecurity - * - * @return $smtpSecurity - */ - public function getSmtpSecurity() { - return $this->smtpSecurity; - } - - /** - * Sets the SmtpSecurity - * - * @param $smtpSecurity - * @return void - */ - public function setSmtpSecurity($smtpSecurity) { - $this->smtpSecurity = $smtpSecurity; - } - - /** - * Gets the MailType - * - * @return String $mailType - */ - public function getMailType() { - return $this->mailType; - } - - /** - * Sets the MailType - * - * @param $mailType - * @return void - */ - public function setMailType($mailType) { - $this->mailType = $mailType; - } - - /** - * Gets the DefaultRecipientAddress - * - * @return $defaultRecipientAddress - */ - public function getDefaultRecipientAddress() { - return $this->defaultRecipientAddress; - } - - /** - * Sets the DefaultRecipientAddress - * - * @param $defaultRecipientAddress - * @return void - */ - public function setDefaultRecipientAddress($defaultRecipientAddress) { - $this->defaultRecipientAddress = $defaultRecipientAddress; - } - - /** - * Gets the DefaultRecipientName - * - * @return $defaultRecipientName - */ - public function getDefaultRecipientName() { - return $this->defaultRecipientName; - } - - /** - * Sets the DefaultRecipientName - * - * @param $defaultRecipientName - * @return void - */ - public function setDefaultRecipientName($defaultRecipientName) { - $this->defaultRecipientName = $defaultRecipientName; - } - } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-09-30 20:49:28
|
Revision: 99 http://sourceforge.net/p/beeframework/code/99 Author: m_plomer Date: 2013-09-30 20:49:26 +0000 (Mon, 30 Sep 2013) Log Message: ----------- Added Paths: ----------- tags/0.9.4/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-09-30 20:48:21
|
Revision: 98 http://sourceforge.net/p/beeframework/code/98 Author: m_plomer Date: 2013-09-30 20:48:18 +0000 (Mon, 30 Sep 2013) Log Message: ----------- - UserBase: increased length of username field so it can accept email addresses as user names Modified Paths: -------------- trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php 2013-09-30 16:47:47 UTC (rev 97) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php 2013-09-30 20:48:18 UTC (rev 98) @@ -22,7 +22,7 @@ /** * @var string - * @Column(name="username", type="string", length=20, nullable=false, unique=true) + * @Column(name="username", type="string", length=150, nullable=false, unique=true) */ private $username; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2013-09-30 16:47:50
|
Revision: 97 http://sourceforge.net/p/beeframework/code/97 Author: m_plomer Date: 2013-09-30 16:47:47 +0000 (Mon, 30 Sep 2013) Log Message: ----------- Added Paths: ----------- tags/0.9.3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |