beeframework-svn Mailing List for Bee Framework (Page 4)
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...> - 2014-09-25 23:53:51
|
Revision: 228 http://sourceforge.net/p/beeframework/code/228 Author: m_plomer Date: 2014-09-25 23:53:45 +0000 (Thu, 25 Sep 2014) Log Message: ----------- Modified Paths: -------------- trunk/framework/Bee/Persistence/PaginationBase.php Modified: trunk/framework/Bee/Persistence/PaginationBase.php =================================================================== --- trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-25 22:36:28 UTC (rev 227) +++ trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-25 23:53:45 UTC (rev 228) @@ -64,6 +64,8 @@ * @param $currentPage */ public function setCurrentPage($currentPage) { + $currentPage = $currentPage < 0 ? 0 : $currentPage; + $currentPage = $currentPage > $this->getPageCount() - 1 ? $this->getPageCount() - 1 : $currentPage; $this->currentPage = $currentPage; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-25 22:36:36
|
Revision: 227 http://sourceforge.net/p/beeframework/code/227 Author: m_plomer Date: 2014-09-25 22:36:28 +0000 (Thu, 25 Sep 2014) Log Message: ----------- - based OrderAndLimit implementation on resultCount rather than page count, moved page calculation to PaginationBase class Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine/DaoBase.php trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php trunk/framework/Bee/Persistence/IOrderAndLimitHolder.php Added Paths: ----------- trunk/framework/Bee/Persistence/PaginationBase.php Modified: trunk/framework/Bee/Persistence/Doctrine/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine/DaoBase.php 2014-09-25 20:21:25 UTC (rev 226) +++ trunk/framework/Bee/Persistence/Doctrine/DaoBase.php 2014-09-25 22:36:28 UTC (rev 227) @@ -144,7 +144,6 @@ } foreach ($orderMapping as $orderField => $orderDir) { -// $query->orderBy($orderField.' '.$orderDir); $query->addOrderBy($orderField . ' ' . $orderDir); } @@ -154,13 +153,7 @@ if ($orderAndLimitHolder->getPageSize() > 0) { $query->limit($orderAndLimitHolder->getPageSize()); - - $pageCount = ceil($query->count($params) / $orderAndLimitHolder->getPageSize()); - $orderAndLimitHolder->setPageCount($pageCount); - - if ($orderAndLimitHolder->getCurrentPage() > $pageCount) { - $orderAndLimitHolder->setCurrentPage($pageCount); - } + $orderAndLimitHolder->setResultCount($query->count($params)); $query->offset($orderAndLimitHolder->getCurrentPage() * $orderAndLimitHolder->getPageSize()); } } Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-25 20:21:25 UTC (rev 226) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-25 22:36:28 UTC (rev 227) @@ -1,5 +1,6 @@ <?php namespace Bee\Persistence\Doctrine2; + /* * Copyright 2008-2014 the original author or authors. * @@ -38,11 +39,11 @@ * @param null $hydrationMode * @return array */ - public function executeListQuery(QueryBuilder $queryBuilder, IRestrictionHolder $restrictionHolder = null, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null, $hydrationMode = null) { - $this->applyFilterRestrictions($queryBuilder, $restrictionHolder); - $this->applyOrderAndLimit($queryBuilder, $orderAndLimitHolder, $defaultOrderMapping); - return $this->getQueryFromBuilder($queryBuilder)->execute(null, $hydrationMode); - } + public function executeListQuery(QueryBuilder $queryBuilder, IRestrictionHolder $restrictionHolder = null, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null, $hydrationMode = null) { + $this->applyFilterRestrictions($queryBuilder, $restrictionHolder); + $this->applyOrderAndLimit($queryBuilder, $orderAndLimitHolder, $defaultOrderMapping); + return $this->getQueryFromBuilder($queryBuilder)->execute(null, $hydrationMode); + } /** * @param QueryBuilder $qb @@ -57,81 +58,73 @@ * @param IRestrictionHolder $restrictionHolder * @internal param QueryBuilder $query */ - protected final function applyFilterRestrictions(QueryBuilder &$queryBuilder, IRestrictionHolder $restrictionHolder = null) { - if (is_null($restrictionHolder)) { - return; - } + protected final function applyFilterRestrictions(QueryBuilder &$queryBuilder, IRestrictionHolder $restrictionHolder = null) { + if (is_null($restrictionHolder)) { + return; + } - if (!Bee_Utils_Strings::hasText($restrictionHolder->getFilterString())) { - return; - } + if (!Bee_Utils_Strings::hasText($restrictionHolder->getFilterString())) { + return; + } - $filterTokens = Bee_Utils_Strings::tokenizeToArray($restrictionHolder->getFilterString(), ' '); - foreach ($filterTokens as $no => $token) { - $andWhereString = ''; - $params = array(); + $filterTokens = Bee_Utils_Strings::tokenizeToArray($restrictionHolder->getFilterString(), ' '); + foreach ($filterTokens as $no => $token) { + $andWhereString = ''; + $params = array(); - $tokenName = 'filtertoken'.$no; - $params[$tokenName] = '%'.$token.'%'; + $tokenName = 'filtertoken' . $no; + $params[$tokenName] = '%' . $token . '%'; - foreach ($restrictionHolder->getFilterableFields() as $fieldName) { - // $fieldName MUST BE A DOCTRINE NAME - if (Bee_Utils_Strings::hasText($andWhereString)) { - $andWhereString .= ' OR '; - } + foreach ($restrictionHolder->getFilterableFields() as $fieldName) { + // $fieldName MUST BE A DOCTRINE NAME + if (Bee_Utils_Strings::hasText($andWhereString)) { + $andWhereString .= ' OR '; + } - $andWhereString .= $fieldName.' LIKE :'.$tokenName; - } + $andWhereString .= $fieldName . ' LIKE :' . $tokenName; + } - if (Bee_Utils_Strings::hasText($andWhereString)) { - $queryBuilder->andWhere($andWhereString); + if (Bee_Utils_Strings::hasText($andWhereString)) { + $queryBuilder->andWhere($andWhereString); - foreach ($params as $key => $value) { - $queryBuilder->setParameter($key, $value); - } - } - } - } + foreach ($params as $key => $value) { + $queryBuilder->setParameter($key, $value); + } + } + } + } /** * @param QueryBuilder $queryBuilder * @param IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping */ - protected final function applyOrderAndLimit(QueryBuilder &$queryBuilder, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null) { - if(is_null($defaultOrderMapping)) { + protected final function applyOrderAndLimit(QueryBuilder &$queryBuilder, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null) { + if (is_null($defaultOrderMapping)) { $defaultOrderMapping = array(); } - if (is_null($orderAndLimitHolder)) { - $orderMapping = $defaultOrderMapping; - } else { - $orderMapping = count($orderAndLimitHolder->getOrderMapping()) > 0 ? $orderAndLimitHolder->getOrderMapping() : $defaultOrderMapping; - } + if (is_null($orderAndLimitHolder)) { + $orderMapping = $defaultOrderMapping; + } else { + $orderMapping = count($orderAndLimitHolder->getOrderMapping()) > 0 ? $orderAndLimitHolder->getOrderMapping() : $defaultOrderMapping; + } - foreach ($orderMapping as $orderField => $orderDir) { - $queryBuilder->addOrderBy($orderField, $orderDir); - } + foreach ($orderMapping as $orderField => $orderDir) { + $queryBuilder->addOrderBy($orderField, $orderDir); + } - if (is_null($orderAndLimitHolder)) { - return; - } + if (is_null($orderAndLimitHolder)) { + return; + } - if ($orderAndLimitHolder->getPageSize() > 0) { - -// $pageCount = ceil(count($this->getQueryFromBuilder($queryBuilder)->execute()) / $orderAndLimitHolder->getPageSize()); - // TODO: optimize use of the Paginator concept. maybe reimplement it in a more specific way? + if ($orderAndLimitHolder->getPageSize() > 0) { $paginator = new Paginator($queryBuilder, false); - $pageCount = ceil(count($paginator) / $orderAndLimitHolder->getPageSize()); - $orderAndLimitHolder->setPageCount($pageCount); + $orderAndLimitHolder->setResultCount(count($paginator)); + $queryBuilder->setFirstResult($orderAndLimitHolder->getCurrentPage() * $orderAndLimitHolder->getPageSize()); + $queryBuilder->setMaxResults($orderAndLimitHolder->getPageSize()); + } + } - if ($orderAndLimitHolder->getCurrentPage() > $pageCount) { - $orderAndLimitHolder->setCurrentPage($pageCount); - } - $queryBuilder->setFirstResult($orderAndLimitHolder->getCurrentPage() * $orderAndLimitHolder->getPageSize()); - $queryBuilder->setMaxResults($orderAndLimitHolder->getPageSize()); - } - } - /** * @param callback $func * @throws Exception Modified: trunk/framework/Bee/Persistence/IOrderAndLimitHolder.php =================================================================== --- trunk/framework/Bee/Persistence/IOrderAndLimitHolder.php 2014-09-25 20:21:25 UTC (rev 226) +++ trunk/framework/Bee/Persistence/IOrderAndLimitHolder.php 2014-09-25 22:36:28 UTC (rev 227) @@ -38,11 +38,6 @@ public function getPageCount(); /** - * @param $pageCount - */ - public function setPageCount($pageCount); - - /** * @return int */ public function getCurrentPage(); @@ -52,4 +47,8 @@ */ public function setCurrentPage($currentPage); + /** + * @param int $resultCount + */ + public function setResultCount($resultCount); } Added: trunk/framework/Bee/Persistence/PaginationBase.php =================================================================== --- trunk/framework/Bee/Persistence/PaginationBase.php (rev 0) +++ trunk/framework/Bee/Persistence/PaginationBase.php 2014-09-25 22:36:28 UTC (rev 227) @@ -0,0 +1,94 @@ +<?php +namespace Bee\Persistence; +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Class BasicListStateHolder + * + * Implements the pagination aspect of the IOrderAndLimitHolder and embodies generic logic for + * @package Bee\Persistence + */ +abstract class PaginationBase implements IOrderAndLimitHolder { + + /** + * @var int + */ + private $pageSize = 50; + + /** + * @var int + */ + private $currentPage = 0; + + /** + * @var int + */ + private $resultCount; + + /** + * @return int + */ + public function getPageSize() { + return $this->pageSize; + } + + /** + * @return int + */ + public function getPageCount() { + return ceil($this->getResultCount() / $this->getPageSize()); + } + + /** + * @return int + */ + public function getCurrentPage() { + return $this->currentPage; + } + + /** + * @param $currentPage + */ + public function setCurrentPage($currentPage) { + $this->currentPage = $currentPage; + } + + /** + * @param int $resultCount + */ + public function setResultCount($resultCount) { + $this->resultCount = $resultCount; + if($this->getCurrentPage() >= $this->getPageCount()) { + $this->setCurrentPage($this->getPageCount() - 1); + } + } + + /** + * @return int + */ + public function getResultCount() { + return $this->resultCount; + } + + /** + * Implements the default behavior in case the current page is beyond the acceptable limit. By default, sets the + * current page to the last page. + */ + protected function adjustCurrentPageOnOverflow() { + $this->setCurrentPage($this->getPageCount() - 1); + } +} \ 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...> - 2014-09-25 20:21:29
|
Revision: 226 http://sourceforge.net/p/beeframework/code/226 Author: m_plomer Date: 2014-09-25 20:21:25 +0000 (Thu, 25 Sep 2014) Log Message: ----------- - added source array setter to Context\Config\ArrayValue Modified Paths: -------------- trunk/framework/Bee/Context/Config/ArrayValue.php Modified: trunk/framework/Bee/Context/Config/ArrayValue.php =================================================================== --- trunk/framework/Bee/Context/Config/ArrayValue.php 2014-09-22 19:18:45 UTC (rev 225) +++ trunk/framework/Bee/Context/Config/ArrayValue.php 2014-09-25 20:21:25 UTC (rev 226) @@ -156,4 +156,11 @@ public function getValue() { return $this->sourceArray; } + + /* + * + */ + public function setValue(array $value) { + $this->sourceArray = $value; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-22 19:18:48
|
Revision: 225 http://sourceforge.net/p/beeframework/code/225 Author: m_plomer Date: 2014-09-22 19:18:45 +0000 (Mon, 22 Sep 2014) Log Message: ----------- - changes to Bee_Utils_Strings::toAscii Modified Paths: -------------- trunk/framework/Bee/Beans/PropertyEditor/PropertyEditorRegistry.php Added Paths: ----------- trunk/framework/Bee/Beans/PropertyEditor/UrlParamPropertyEditor.php Modified: trunk/framework/Bee/Beans/PropertyEditor/PropertyEditorRegistry.php =================================================================== --- trunk/framework/Bee/Beans/PropertyEditor/PropertyEditorRegistry.php 2014-09-22 09:01:40 UTC (rev 224) +++ trunk/framework/Bee/Beans/PropertyEditor/PropertyEditorRegistry.php 2014-09-22 19:18:45 UTC (rev 225) @@ -139,3 +139,4 @@ PropertyEditorRegistry::registerEditor(ITypeDefinitions::ARRAY_TYPE, new StringPropertyEditor()); PropertyEditorRegistry::registerEditor(ConstantPropertyEditor::TYPE_STRING, new ConstantPropertyEditor()); +PropertyEditorRegistry::registerEditor(UrlParamPropertyEditor::TYPE_STRING, new UrlParamPropertyEditor()); Added: trunk/framework/Bee/Beans/PropertyEditor/UrlParamPropertyEditor.php =================================================================== --- trunk/framework/Bee/Beans/PropertyEditor/UrlParamPropertyEditor.php (rev 0) +++ trunk/framework/Bee/Beans/PropertyEditor/UrlParamPropertyEditor.php 2014-09-22 19:18:45 UTC (rev 225) @@ -0,0 +1,38 @@ +<?php + +namespace Bee\Beans\PropertyEditor; +use Bee\Beans\IPropertyEditor; +use Exception; + + +/** + * Class UrlParamPropertyEditor + * @package Bee\Beans\PropertyEditor + */ +class UrlParamPropertyEditor implements IPropertyEditor { + + const TYPE_STRING = 'urlparams'; + + /** + * Enter description here... + * + * @param mixed $value + * @throws Exception + * @return String + */ + public function toString($value) { + throw new Exception('not implemented'); + } + + /** + * Enter description here... + * + * @param String $value + * @return mixed + */ + public function fromString($value) { + $result = array(); + parse_str($value, $result); + 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...> - 2014-09-22 09:01:49
|
Revision: 224 http://sourceforge.net/p/beeframework/code/224 Author: m_plomer Date: 2014-09-22 09:01:40 +0000 (Mon, 22 Sep 2014) Log Message: ----------- - changes to Bee_Utils_Strings::toAscii Modified Paths: -------------- branches/0.9-dev/framework/Bee/Utils/Strings.php Modified: branches/0.9-dev/framework/Bee/Utils/Strings.php =================================================================== --- branches/0.9-dev/framework/Bee/Utils/Strings.php 2014-09-22 08:59:52 UTC (rev 223) +++ branches/0.9-dev/framework/Bee/Utils/Strings.php 2014-09-22 09:01:40 UTC (rev 224) @@ -213,12 +213,13 @@ * * @return string */ - public static function toAscii($string, $table=array(), $delimiter='-', $toLowercase=true) { + public static function toAscii($string, $table=array(), $delimiter='-', $toLowercase=true, $allowEmailChars=false) { if (count($table)>0) { $string = strtr($string, $table); } $ascii = iconv('UTF-8', 'ASCII//TRANSLIT', $string); - $ascii = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $ascii); + $emailChars = $allowEmailChars ? '@.' : ''; + $ascii = preg_replace("/[^a-zA-Z0-9\/_|+ -".$emailChars."]/", '', $ascii); $ascii = trim($ascii, '-'); $ascii = preg_replace("/[\/_|+ -]+/", $delimiter, $ascii); return $toLowercase ? strtolower($ascii) : $ascii; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-22 09:00:00
|
Revision: 223 http://sourceforge.net/p/beeframework/code/223 Author: m_plomer Date: 2014-09-22 08:59:52 +0000 (Mon, 22 Sep 2014) Log Message: ----------- - changes to Bee_Utils_Strings::toAscii Modified Paths: -------------- trunk/framework/Bee/Utils/Strings.php Modified: trunk/framework/Bee/Utils/Strings.php =================================================================== --- trunk/framework/Bee/Utils/Strings.php 2014-09-18 06:19:09 UTC (rev 222) +++ trunk/framework/Bee/Utils/Strings.php 2014-09-22 08:59:52 UTC (rev 223) @@ -214,12 +214,13 @@ * * @return string */ - public static function toAscii($string, $table=array(), $delimiter='-', $toLowercase=true) { + public static function toAscii($string, $table=array(), $delimiter='-', $toLowercase=true, $allowEmailChars=false) { if (count($table)>0) { $string = strtr($string, $table); } $ascii = iconv('UTF-8', 'ASCII//TRANSLIT', $string); - $ascii = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $ascii); + $emailChars = $allowEmailChars ? '@.' : ''; + $ascii = preg_replace("/[^a-zA-Z0-9\/_|+ -".$emailChars."]/", '', $ascii); $ascii = trim($ascii, '-'); $ascii = preg_replace("/[\/_|+ -]+/", $delimiter, $ascii); return $toLowercase ? strtolower($ascii) : $ascii; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-18 06:19:15
|
Revision: 222 http://sourceforge.net/p/beeframework/code/222 Author: m_plomer Date: 2014-09-18 06:19:09 +0000 (Thu, 18 Sep 2014) Log Message: ----------- - use Doctrine2 paginator in DaoBase Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-18 04:16:17 UTC (rev 221) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-18 06:19:09 UTC (rev 222) @@ -20,6 +20,7 @@ use Bee_Utils_Strings; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; +use Doctrine\ORM\Tools\Pagination\Paginator; use Exception; /** @@ -117,8 +118,10 @@ if ($orderAndLimitHolder->getPageSize() > 0) { - // TODO: build a performant count-query! This is simply bullshit! - $pageCount = ceil(count($this->getQueryFromBuilder($queryBuilder)->execute()) / $orderAndLimitHolder->getPageSize()); +// $pageCount = ceil(count($this->getQueryFromBuilder($queryBuilder)->execute()) / $orderAndLimitHolder->getPageSize()); + // TODO: optimize use of the Paginator concept. maybe reimplement it in a more specific way? + $paginator = new Paginator($queryBuilder, false); + $pageCount = ceil(count($paginator) / $orderAndLimitHolder->getPageSize()); $orderAndLimitHolder->setPageCount($pageCount); if ($orderAndLimitHolder->getCurrentPage() > $pageCount) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-18 04:16:21
|
Revision: 221 http://sourceforge.net/p/beeframework/code/221 Author: m_plomer Date: 2014-09-18 04:16:17 +0000 (Thu, 18 Sep 2014) Log Message: ----------- - minor fixes in DaoBase Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-18 02:01:49 UTC (rev 220) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-18 04:16:17 UTC (rev 221) @@ -37,7 +37,7 @@ * @param null $hydrationMode * @return array */ - public function executeListQuery(QueryBuilder $queryBuilder, IRestrictionHolder $restrictionHolder = null, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping, $hydrationMode = null) { + public function executeListQuery(QueryBuilder $queryBuilder, IRestrictionHolder $restrictionHolder = null, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null, $hydrationMode = null) { $this->applyFilterRestrictions($queryBuilder, $restrictionHolder); $this->applyOrderAndLimit($queryBuilder, $orderAndLimitHolder, $defaultOrderMapping); return $this->getQueryFromBuilder($queryBuilder)->execute(null, $hydrationMode); @@ -97,7 +97,10 @@ * @param IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping */ - protected final function applyOrderAndLimit(QueryBuilder &$queryBuilder, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = array()) { + protected final function applyOrderAndLimit(QueryBuilder &$queryBuilder, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = null) { + if(is_null($defaultOrderMapping)) { + $defaultOrderMapping = array(); + } if (is_null($orderAndLimitHolder)) { $orderMapping = $defaultOrderMapping; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-18 02:01:57
|
Revision: 220 http://sourceforge.net/p/beeframework/code/220 Author: m_plomer Date: 2014-09-18 02:01:49 +0000 (Thu, 18 Sep 2014) Log Message: ----------- - MVC: fixed broken handling of optional parameters in AnnotationBasedInvocator Modified Paths: -------------- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/HandlerMethodMetadata.php Modified: trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/HandlerMethodMetadata.php =================================================================== --- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/HandlerMethodMetadata.php 2014-09-18 01:53:52 UTC (rev 219) +++ trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/HandlerMethodMetadata.php 2014-09-18 02:01:49 UTC (rev 220) @@ -57,7 +57,7 @@ foreach ($method->getParameters() as $param) { $typeName = array_key_exists($param->getName(), $typeNameMap) ? $typeNameMap[$param->getName()] : - (!is_null($param->getClass()) ? $param->getClass()->getName() : ITypeDefinitions::STRING); + (!is_null($param->getClass()) ? $param->getClass()->getName() : ($param->isArray() ? ITypeDefinitions::ARRAY_TYPE : ITypeDefinitions::STRING)); if ($typeName == 'Bee_MVC_IHttpRequest') { $this->requestParamPos[$param->getPosition()] = true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-18 01:53:56
|
Revision: 219 http://sourceforge.net/p/beeframework/code/219 Author: m_plomer Date: 2014-09-18 01:53:52 +0000 (Thu, 18 Sep 2014) Log Message: ----------- - MVC: fixed broken handling of optional parameters in AnnotationBasedInvocator Modified Paths: -------------- trunk/framework/Bee/Beans/PropertyEditor/PropertyEditorRegistry.php trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/AnnotationBasedInvocator.php Modified: trunk/framework/Bee/Beans/PropertyEditor/PropertyEditorRegistry.php =================================================================== --- trunk/framework/Bee/Beans/PropertyEditor/PropertyEditorRegistry.php 2014-09-17 23:51:13 UTC (rev 218) +++ trunk/framework/Bee/Beans/PropertyEditor/PropertyEditorRegistry.php 2014-09-18 01:53:52 UTC (rev 219) @@ -135,5 +135,7 @@ PropertyEditorRegistry::registerEditor(ITypeDefinitions::UNIX_TIMESTAMP, new UnixTimestampPropertyEditor()); PropertyEditorRegistry::registerEditor(ITypeDefinitions::STRING, new StringPropertyEditor()); PropertyEditorRegistry::registerEditor(ITypeDefinitions::BASE64, new Base64StringPropertyEditor()); +// todo: implement actual ArraPropertyEditor +PropertyEditorRegistry::registerEditor(ITypeDefinitions::ARRAY_TYPE, new StringPropertyEditor()); PropertyEditorRegistry::registerEditor(ConstantPropertyEditor::TYPE_STRING, new ConstantPropertyEditor()); Modified: trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/AnnotationBasedInvocator.php =================================================================== --- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/AnnotationBasedInvocator.php 2014-09-17 23:51:13 UTC (rev 218) +++ trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/AnnotationBasedInvocator.php 2014-09-18 01:53:52 UTC (rev 219) @@ -103,6 +103,8 @@ (array_key_exists($parameter->getName(), $_REQUEST) ? $_REQUEST[$parameter->getName()] : null); if (!is_null($value) || !$parameter->isOptional()) { $args[$pos] = $propEditor->fromString($value); + } else { + $args[$pos] = null; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-17 23:51:23
|
Revision: 218 http://sourceforge.net/p/beeframework/code/218 Author: m_plomer Date: 2014-09-17 23:51:13 +0000 (Wed, 17 Sep 2014) Log Message: ----------- - fixed broken pagination in DaoBase Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-17 13:37:04 UTC (rev 217) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-17 23:51:13 UTC (rev 218) @@ -113,7 +113,6 @@ } if ($orderAndLimitHolder->getPageSize() > 0) { - $queryBuilder->setMaxResults($orderAndLimitHolder->getPageSize()); // TODO: build a performant count-query! This is simply bullshit! $pageCount = ceil(count($this->getQueryFromBuilder($queryBuilder)->execute()) / $orderAndLimitHolder->getPageSize()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-17 13:37:15
|
Revision: 217 http://sourceforge.net/p/beeframework/code/217 Author: m_plomer Date: 2014-09-17 13:37:04 +0000 (Wed, 17 Sep 2014) Log Message: ----------- - fixed HashManager Modified Paths: -------------- branches/0.9-dev/framework/Bee/Utils/HashManager.php Modified: branches/0.9-dev/framework/Bee/Utils/HashManager.php =================================================================== --- branches/0.9-dev/framework/Bee/Utils/HashManager.php 2014-09-12 20:21:31 UTC (rev 216) +++ branches/0.9-dev/framework/Bee/Utils/HashManager.php 2014-09-17 13:37:04 UTC (rev 217) @@ -1,10 +1,27 @@ <?php - namespace Bee\Utils; - +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ use PDO; use Exception; +/** + * Class HashManager + * @package Bee\Utils + */ class HashManager { /** @@ -58,7 +75,7 @@ } catch (Exception $e) { $hash = $this->createHash(); - if ($this->persistHash($this->createHash(), $id, $group)) { + if ($this->persistHash($hash, $id, $group)) { return $hash; } return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-12 20:21:42
|
Revision: 216 http://sourceforge.net/p/beeframework/code/216 Author: m_plomer Date: 2014-09-12 20:21:31 +0000 (Fri, 12 Sep 2014) Log Message: ----------- - replaced HardcodedNamespaceHandlerResolver with configurable DefaultNamespaceHandlerResolver Modified Paths: -------------- trunk/framework/Bee/Context/Xml/DefaultNamespaceHandlerResolver.php Modified: trunk/framework/Bee/Context/Xml/DefaultNamespaceHandlerResolver.php =================================================================== --- trunk/framework/Bee/Context/Xml/DefaultNamespaceHandlerResolver.php 2014-09-12 20:10:44 UTC (rev 215) +++ trunk/framework/Bee/Context/Xml/DefaultNamespaceHandlerResolver.php 2014-09-12 20:21:31 UTC (rev 216) @@ -68,8 +68,9 @@ */ protected function initialize() { if(!$this->initialized) { - if(file_exists('namespaces.ini')) { - foreach(parse_ini_file('namespaces.ini') as $namespaceUri => $handlerClassName) { + if(file_exists('namespaces.json')) { + $nsConf = json_decode(file_get_contents('namespaces.json'), true); + foreach($nsConf as $namespaceUri => $handlerClassName) { self::registerHandler($namespaceUri, $handlerClassName); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-12 14:52:05
|
Revision: 214 http://sourceforge.net/p/beeframework/code/214 Author: m_plomer Date: 2014-09-12 14:51:58 +0000 (Fri, 12 Sep 2014) Log Message: ----------- - finished incomplete refactoring of IOrderAndLimitHolder / IRestrictionHolder into namespace Modified Paths: -------------- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/AnnotationBasedInvocator.php trunk/framework/Bee/Persistence/Doctrine/DaoBase.php trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php Modified: trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/AnnotationBasedInvocator.php =================================================================== --- trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/AnnotationBasedInvocator.php 2014-09-11 01:39:50 UTC (rev 213) +++ trunk/framework/Bee/MVC/Controller/Multiaction/HandlerMethodInvocator/AnnotationBasedInvocator.php 2014-09-12 14:51:58 UTC (rev 214) @@ -68,9 +68,10 @@ $this->defaultMethodInvocation = new MethodInvocation($methodMeta); } - if (Bee_Framework::getProductionMode()) { - Bee_Cache_Manager::store($cacheKey, $this->defaultMethodInvocation); - } + // todo: fix production mode method caching +// if (Bee_Framework::getProductionMode()) { +// Bee_Cache_Manager::store($cacheKey, $this->defaultMethodInvocation); +// } } return $this->defaultMethodInvocation; } Modified: trunk/framework/Bee/Persistence/Doctrine/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine/DaoBase.php 2014-09-11 01:39:50 UTC (rev 213) +++ trunk/framework/Bee/Persistence/Doctrine/DaoBase.php 2014-09-12 14:51:58 UTC (rev 214) @@ -15,6 +15,9 @@ * limitations under the License. */ +use Bee\Persistence\IOrderAndLimitHolder; +use Bee\Persistence\IRestrictionHolder; + class Bee_Persistence_Doctrine_DaoBase { /** @@ -61,13 +64,13 @@ /** * @param Doctrine_Query $query * @param array $params - * @param Bee_Persistence_IRestrictionHolder $restrictionHolder - * @param Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder + * @param IRestrictionHolder $restrictionHolder + * @param IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping * * @return array */ - public function executeListQuery(Doctrine_Query $query, array $params=array(), Bee_Persistence_IRestrictionHolder $restrictionHolder = null, Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping) { + public function executeListQuery(Doctrine_Query $query, array $params=array(), IRestrictionHolder $restrictionHolder = null, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping) { $this->applyFilterRestrictions($query, $params, $restrictionHolder); $this->applyOrderAndLimit($query, $params, $orderAndLimitHolder, $defaultOrderMapping); $result = $query->execute($params); @@ -77,9 +80,9 @@ /** * @param Doctrine_Query $query * @param array $params - * @param Bee_Persistence_IRestrictionHolder $restrictionHolder + * @param IRestrictionHolder $restrictionHolder */ - protected final function applyFilterRestrictions(Doctrine_Query &$query, array &$params, Bee_Persistence_IRestrictionHolder $restrictionHolder = null) { + protected final function applyFilterRestrictions(Doctrine_Query &$query, array &$params, IRestrictionHolder $restrictionHolder = null) { if (is_null($restrictionHolder)) { return; } @@ -130,10 +133,10 @@ /** * @param Doctrine_Query $query * @param array $params - * @param Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder + * @param IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping */ - protected final function applyOrderAndLimit(Doctrine_Query &$query, array &$params, Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = array()) { + protected final function applyOrderAndLimit(Doctrine_Query &$query, array &$params, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = array()) { if (is_null($orderAndLimitHolder)) { $orderMapping = $defaultOrderMapping; } else { Modified: trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-11 01:39:50 UTC (rev 213) +++ trunk/framework/Bee/Persistence/Doctrine2/DaoBase.php 2014-09-12 14:51:58 UTC (rev 214) @@ -15,8 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -use Bee_Persistence_IOrderAndLimitHolder; -use Bee_Persistence_IRestrictionHolder; +use Bee\Persistence\IOrderAndLimitHolder; +use Bee\Persistence\IRestrictionHolder; use Bee_Utils_Strings; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; @@ -31,13 +31,13 @@ /** * @param QueryBuilder $queryBuilder - * @param Bee_Persistence_IRestrictionHolder $restrictionHolder - * @param Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder + * @param IRestrictionHolder $restrictionHolder + * @param IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping * @param null $hydrationMode * @return array */ - public function executeListQuery(QueryBuilder $queryBuilder, Bee_Persistence_IRestrictionHolder $restrictionHolder = null, Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping, $hydrationMode = null) { + public function executeListQuery(QueryBuilder $queryBuilder, IRestrictionHolder $restrictionHolder = null, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping, $hydrationMode = null) { $this->applyFilterRestrictions($queryBuilder, $restrictionHolder); $this->applyOrderAndLimit($queryBuilder, $orderAndLimitHolder, $defaultOrderMapping); return $this->getQueryFromBuilder($queryBuilder)->execute(null, $hydrationMode); @@ -53,10 +53,10 @@ /** * @param QueryBuilder $queryBuilder - * @param Bee_Persistence_IRestrictionHolder $restrictionHolder + * @param IRestrictionHolder $restrictionHolder * @internal param QueryBuilder $query */ - protected final function applyFilterRestrictions(QueryBuilder &$queryBuilder, Bee_Persistence_IRestrictionHolder $restrictionHolder = null) { + protected final function applyFilterRestrictions(QueryBuilder &$queryBuilder, IRestrictionHolder $restrictionHolder = null) { if (is_null($restrictionHolder)) { return; } @@ -94,10 +94,10 @@ /** * @param QueryBuilder $queryBuilder - * @param Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder + * @param IOrderAndLimitHolder $orderAndLimitHolder * @param array $defaultOrderMapping */ - protected final function applyOrderAndLimit(QueryBuilder &$queryBuilder, Bee_Persistence_IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = array()) { + protected final function applyOrderAndLimit(QueryBuilder &$queryBuilder, IOrderAndLimitHolder $orderAndLimitHolder = null, array $defaultOrderMapping = array()) { if (is_null($orderAndLimitHolder)) { $orderMapping = $defaultOrderMapping; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-11 01:39:54
|
Revision: 213 http://sourceforge.net/p/beeframework/code/213 Author: m_plomer Date: 2014-09-11 01:39:50 +0000 (Thu, 11 Sep 2014) Log Message: ----------- - D2 EnumType: fixed compatibility with early 5.3 version (which exhibit quirks in reflected access to late statically bound methods) Modified Paths: -------------- trunk/framework/Bee/Persistence/IOrderAndLimitHolder.php trunk/framework/Bee/Persistence/IRestrictionHolder.php Modified: trunk/framework/Bee/Persistence/IOrderAndLimitHolder.php =================================================================== --- trunk/framework/Bee/Persistence/IOrderAndLimitHolder.php 2014-09-10 21:32:02 UTC (rev 212) +++ trunk/framework/Bee/Persistence/IOrderAndLimitHolder.php 2014-09-11 01:39:50 UTC (rev 213) @@ -1,4 +1,5 @@ <?php +namespace Bee\Persistence; /* * Copyright 2008-2014 the original author or authors. * @@ -15,7 +16,11 @@ * limitations under the License. */ -interface Bee_Persistence_IOrderAndLimitHolder { +/** + * Interface IOrderAndLimitHolder + * @package Bee\Persistence + */ +interface IOrderAndLimitHolder { /** * @return array Modified: trunk/framework/Bee/Persistence/IRestrictionHolder.php =================================================================== --- trunk/framework/Bee/Persistence/IRestrictionHolder.php 2014-09-10 21:32:02 UTC (rev 212) +++ trunk/framework/Bee/Persistence/IRestrictionHolder.php 2014-09-11 01:39:50 UTC (rev 213) @@ -1,4 +1,5 @@ <?php +namespace Bee\Persistence; /* * Copyright 2008-2014 the original author or authors. * @@ -15,7 +16,11 @@ * limitations under the License. */ -interface Bee_Persistence_IRestrictionHolder { +/** + * Interface IRestrictionHolder + * @package Bee\Persistence + */ +interface IRestrictionHolder { /** * @return array This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-10 21:32:08
|
Revision: 212 http://sourceforge.net/p/beeframework/code/212 Author: m_plomer Date: 2014-09-10 21:32:02 +0000 (Wed, 10 Sep 2014) Log Message: ----------- - D2 EnumType: fixed compatibility with early 5.3 version (which exhibit quirks in reflected access to late statically bound methods) Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php Modified: trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php 2014-09-10 17:13:01 UTC (rev 211) +++ trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php 2014-09-10 21:32:02 UTC (rev 212) @@ -41,7 +41,7 @@ } public function convertToPHPValue($value, AbstractPlatform $platform) { - return call_user_func(array(static::getEnumClassName(), 'get')); + return call_user_func(array(static::getEnumClassName(), 'get'), $value); } public function convertToDatabaseValue($value, AbstractPlatform $platform) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-10 17:13:13
|
Revision: 211 http://sourceforge.net/p/beeframework/code/211 Author: m_plomer Date: 2014-09-10 17:13:01 +0000 (Wed, 10 Sep 2014) Log Message: ----------- - D2 EnumType: fixed compatibility with early 5.3 version (which exhibit quirks in reflected access to late statically bound methods) Modified Paths: -------------- trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php Modified: trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php 2014-09-08 13:49:56 UTC (rev 210) +++ trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php 2014-09-10 17:13:01 UTC (rev 211) @@ -27,11 +27,6 @@ const ENUM_BASE_TYPE = 'Bee\Utils\EnumBase'; /** - * @var \ReflectionClass - */ - private $reflClass; - - /** * @return string */ protected static function getEnumClassName() { @@ -39,7 +34,6 @@ } public function getSqlDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { - if (!$this->reflClass) self::init(); $values = array_map(function ($val) { return "'" . $val . "'"; }, call_user_func(array(static::getEnumClassName(), 'getValues'))); @@ -47,16 +41,14 @@ } public function convertToPHPValue($value, AbstractPlatform $platform) { - if (!$this->reflClass) self::init(); - return $this->reflClass->getMethod('get')->invoke(null, $value); + return call_user_func(array(static::getEnumClassName(), 'get')); } public function convertToDatabaseValue($value, AbstractPlatform $platform) { - if (!$this->reflClass) self::init(); - if(is_null($val)) { + if(is_null($value)) { return $value; } - if (!$this->reflClass->isInstance($value)) { + if (get_class($value) != static::getEnumClassName()) { throw new \UnexpectedValueException('Not a valid enum element for "' . static::getEnumClassName() . '": ' . $value); } // check if value is valid @@ -65,13 +57,6 @@ return $value->val(); } - private function init() { - $this->reflClass = new \ReflectionClass(static::getEnumClassName()); - if (!$this->reflClass->isSubclassOf(self::ENUM_BASE_TYPE)) { - throw new \UnexpectedValueException('"' . $this->reflClass . '" is not a subclass of "' . self::ENUM_BASE_TYPE . '"'); - } - } - public function getName() { return self::getEnumName(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-08 13:50:02
|
Revision: 210 http://sourceforge.net/p/beeframework/code/210 Author: m_plomer Date: 2014-09-08 13:49:56 +0000 (Mon, 08 Sep 2014) Log Message: ----------- - introduced UserManagerBase Modified Paths: -------------- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserDetailsService.php trunk/framework/Bee/Security/UserDetails/UserManagerBase.php Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserDetailsService.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserDetailsService.php 2014-09-08 13:37:14 UTC (rev 209) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserDetailsService.php 2014-09-08 13:49:56 UTC (rev 210) @@ -105,10 +105,12 @@ /** * @param UserBase $user + * @return UserBase */ public function addUser(UserBase $user) { $this->getEntityManager()->persist($user); $this->getEntityManager()->flush($user); + return $user; } /** Modified: trunk/framework/Bee/Security/UserDetails/UserManagerBase.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/UserManagerBase.php 2014-09-08 13:37:14 UTC (rev 209) +++ trunk/framework/Bee/Security/UserDetails/UserManagerBase.php 2014-09-08 13:49:56 UTC (rev 210) @@ -70,9 +70,13 @@ return $this->saltSource; } - public function createOrUpdateUser($frmdata) { + /** + * @param array $frmdata + * @return UserBase + * @throws Exception + */ + public function createOrUpdateUser(array $frmdata) { $user = is_numeric($frmdata['id']) ? $this->loadById($frmdata['id']) : $this->createUserInstance(); - $model['user'] = $user; $user->setUsername($frmdata['username']); $user->setName($frmdata['fullname']); if (Bee_Utils_Strings::hasText($frmdata['password'])) { @@ -83,7 +87,7 @@ } $user->setDisabled(filter_var($frmdata['deactivated'], FILTER_VALIDATE_BOOLEAN)); $this->setRoles($frmdata, $user); - $this->addUser($user); + return $this->addUser($user); } /** @@ -124,7 +128,7 @@ /** * @param UserBase $user - * @return void + * @return UserBase */ abstract public function addUser(UserBase $user); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-08 13:37:26
|
Revision: 209 http://sourceforge.net/p/beeframework/code/209 Author: m_plomer Date: 2014-09-08 13:37:14 +0000 (Mon, 08 Sep 2014) Log Message: ----------- - introduced UserManagerBase Modified Paths: -------------- trunk/framework/Bee/Security/AbstractAuthenticationManager.php trunk/framework/Bee/Security/Anonymous/Filter.php trunk/framework/Bee/Security/IUserDetailsService.php trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserBase.php trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserDetailsService.php trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php trunk/framework/Bee/Utils/SmartyMailer.php Added Paths: ----------- trunk/framework/Bee/Security/UserDetails/UserManagerBase.php Modified: trunk/framework/Bee/Security/AbstractAuthenticationManager.php =================================================================== --- trunk/framework/Bee/Security/AbstractAuthenticationManager.php 2014-09-07 09:42:46 UTC (rev 208) +++ trunk/framework/Bee/Security/AbstractAuthenticationManager.php 2014-09-08 13:37:14 UTC (rev 209) @@ -1,6 +1,6 @@ <?php /* - * Copyright 2008-2010 the original author or authors. + * Copyright 2008-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,5 +59,4 @@ public final function setClearExtraInformation($clearExtraInformation) { $this->clearExtraInformation = $clearExtraInformation; } - } \ No newline at end of file Modified: trunk/framework/Bee/Security/Anonymous/Filter.php =================================================================== --- trunk/framework/Bee/Security/Anonymous/Filter.php 2014-09-07 09:42:46 UTC (rev 208) +++ trunk/framework/Bee/Security/Anonymous/Filter.php 2014-09-08 13:37:14 UTC (rev 209) @@ -202,4 +202,3 @@ } } -?> Modified: trunk/framework/Bee/Security/IUserDetailsService.php =================================================================== --- trunk/framework/Bee/Security/IUserDetailsService.php 2014-09-07 09:42:46 UTC (rev 208) +++ trunk/framework/Bee/Security/IUserDetailsService.php 2014-09-08 13:37:14 UTC (rev 209) @@ -25,18 +25,16 @@ * </p> */ interface Bee_Security_IUserDetailsService { - + /** - * Locates the user based on the username. In the actual implementation, the search may possibly be case - * insensitive, or case insensitive depending on how the implementaion instance is configured. In this case, the - * <code>Bee_Security_IUserDetails</code> object that comes back may have a username that is of a different case - * than what was actually requested. - * + * Locates the user based on the username. In the actual implementation, the search may possibly be case + * insensitive, or case insensitive depending on how the implementaion instance is configured. In this case, the + * <code>Bee_Security_IUserDetails</code> object that comes back may have a username that is of a different case + * than what was actually requested. + * + * @param $username * @return Bee_Security_IUserDetails a fully populated user record (never <code>null</code>) - * - * @throws Bee_Security_Exception_UsernameNotFound - * @throws Bee_Persistence_Exception_DataAccess + * */ function loadUserByUsername($username); -} -?> \ No newline at end of file +} \ No newline at end of file Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php 2014-09-07 09:42:46 UTC (rev 208) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUser.php 2014-09-08 13:37:14 UTC (rev 209) @@ -1,5 +1,20 @@ <?php namespace Bee\Security\UserDetails\Doctrine2; +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** * Simple user entity class Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserBase.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserBase.php 2014-09-07 09:42:46 UTC (rev 208) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserBase.php 2014-09-08 13:37:14 UTC (rev 209) @@ -1,8 +1,23 @@ <?php namespace Bee\Security\UserDetails\Doctrine2; +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + use \Bee_Security_IGrantedAuthority; - /** * Base class for user entities * @package Bee\Security\UserDetails\Doctrine2 @@ -41,18 +56,27 @@ $this->updateRoles(); } + /** + * @param $role + */ public function removeRole($role) { $this->getAuthorities(); unset($this->rolesTransformed[$role]); $this->updateRoles(); } + /** + * @param $role + * @return bool + */ 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 Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserDetailsService.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserDetailsService.php 2014-09-07 09:42:46 UTC (rev 208) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/SimpleUserDetailsService.php 2014-09-08 13:37:14 UTC (rev 209) @@ -1,5 +1,22 @@ <?php namespace Bee\Security\UserDetails\Doctrine2; +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +use Bee\Security\UserDetails\UserManagerBase; use Bee_Security_Exception_UsernameNotFound; use Bee_Security_IUserDetails; use Bee_Security_IUserDetailsService; @@ -10,7 +27,7 @@ * Class SimpleUserDetailsService * @package Bee\Security\UserDetails\Doctrine2 */ -class SimpleUserDetailsService implements Bee_Security_IUserDetailsService { +class SimpleUserDetailsService extends UserManagerBase implements Bee_Security_IUserDetailsService { /** * @var EntityManager @@ -101,4 +118,27 @@ $this->getEntityManager()->remove($user); $this->getEntityManager()->flush($user); } + + /** + * @param array $frmdata + * @param UserBase $user + * @return UserBase + */ + public function setRoles(array $frmdata, UserBase $user) { + /** @var SimpleUser $user */ + if ($frmdata['admin']) { + $user->addRole('ROLE_ADMINISTRATOR'); + } else { + $user->removeRole('ROLE_ADMINISTRATOR'); + } + $user->addRole('ROLE_USER'); + return $user; + } + + /** + * @return UserBase + */ + public function createUserInstance() { + return new $this->userEntityName(); + } } \ No newline at end of file Modified: trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php 2014-09-07 09:42:46 UTC (rev 208) +++ trunk/framework/Bee/Security/UserDetails/Doctrine2/UserBase.php 2014-09-08 13:37:14 UTC (rev 209) @@ -1,9 +1,23 @@ <?php +namespace Bee\Security\UserDetails\Doctrine2; +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -namespace Bee\Security\UserDetails\Doctrine2; use Bee_Security_IUserDetails; - /** * Class UserBase * @package Bee\Security\UserDetails\Doctrine2 Added: trunk/framework/Bee/Security/UserDetails/UserManagerBase.php =================================================================== --- trunk/framework/Bee/Security/UserDetails/UserManagerBase.php (rev 0) +++ trunk/framework/Bee/Security/UserDetails/UserManagerBase.php 2014-09-08 13:37:14 UTC (rev 209) @@ -0,0 +1,135 @@ +<?php +namespace Bee\Security\UserDetails; +/* + * Copyright 2008-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +use Bee\Security\UserDetails\Doctrine2\UserBase; +use Bee_Security_IPasswordEncoder; +use Bee_Security_Provider_ISaltSource; +use Bee_Utils_Strings; +use Exception; + +/** + * Class UserManagerBase + * @package Bee\Security\UserDetails + */ +abstract class UserManagerBase { + + /** + * Enter description here... + * + * @var Bee_Security_IPasswordEncoder + */ + private $passwordEncoder; + + /** + * Enter description here... + * + * @var Bee_Security_Provider_ISaltSource + */ + private $saltSource = null; + + /** + * @param Bee_Security_IPasswordEncoder $passwordEncoder + */ + public function setPasswordEncoder(Bee_Security_IPasswordEncoder $passwordEncoder) { + $this->passwordEncoder = $passwordEncoder; + } + + /** + * @return Bee_Security_IPasswordEncoder + */ + public function getPasswordEncoder() { + return $this->passwordEncoder; + } + + /** + * @param Bee_Security_Provider_ISaltSource $saltSource + */ + public function setSaltSource(Bee_Security_Provider_ISaltSource $saltSource) { + $this->saltSource = $saltSource; + } + + /** + * @return Bee_Security_Provider_ISaltSource + */ + public function getSaltSource() { + return $this->saltSource; + } + + public function createOrUpdateUser($frmdata) { + $user = is_numeric($frmdata['id']) ? $this->loadById($frmdata['id']) : $this->createUserInstance(); + $model['user'] = $user; + $user->setUsername($frmdata['username']); + $user->setName($frmdata['fullname']); + if (Bee_Utils_Strings::hasText($frmdata['password'])) { + if ($frmdata['password'] !== $frmdata['password2']) { + throw new Exception("Passwords do not match!"); + } + $this->setPassword($user, $frmdata['password']); + } + $user->setDisabled(filter_var($frmdata['deactivated'], FILTER_VALIDATE_BOOLEAN)); + $this->setRoles($frmdata, $user); + $this->addUser($user); + } + + /** + * @param UserBase $user + * @param $password + */ + public function setPassword(UserBase $user, $password) { + $user->setPassword($this->getPasswordEncoder()->encodePassword($password, $this->getSaltSource()->getSalt($user))); + } + + /** + * @param int $length + * @return string + */ + public function getRandomPassword($length = 8) { + $alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789"; + $pass = ''; + $alphaLength = strlen($alphabet) - 1; + for ($i = 0; $i < $length; $i++) { + $n = rand(0, $alphaLength); + $pass .= $alphabet[$n]; + } + return $pass; + } + + /** + * @param $id + * @return UserBase + */ + abstract public function loadById($id); + + /** + * @param array $frmdata + * @param UserBase $user + * @return UserBase + */ + abstract public function setRoles(array $frmdata, UserBase $user); + + /** + * @param UserBase $user + * @return void + */ + abstract public function addUser(UserBase $user); + + /** + * @return UserBase + */ + abstract public function createUserInstance(); +} \ No newline at end of file Modified: trunk/framework/Bee/Utils/SmartyMailer.php =================================================================== --- trunk/framework/Bee/Utils/SmartyMailer.php 2014-09-07 09:42:46 UTC (rev 208) +++ trunk/framework/Bee/Utils/SmartyMailer.php 2014-09-08 13:37:14 UTC (rev 209) @@ -64,7 +64,10 @@ public function logMail($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) { $phpMailer = $this->instantiatePhpMailer($subjectTemplate, $bodyTemplate, $model, $recipient, $sender); if($this->messageLogFile && $phpMailer->preSend()) { - file_put_contents($this->messageLogFile, $phpMailer->getMailMIME()); + $message = $phpMailer->getMailMIME() . "\n\n"; + $message .= $phpMailer->Subject . "\n\n"; + $message .= $phpMailer->Body . "\n\n"; + file_put_contents($this->messageLogFile, $message); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-07 09:42:50
|
Revision: 208 http://sourceforge.net/p/beeframework/code/208 Author: m_plomer Date: 2014-09-07 09:42:46 +0000 (Sun, 07 Sep 2014) Log Message: ----------- - backports from 0.10 trunk Modified Paths: -------------- branches/0.9-dev/framework/Bee/Utils/SmartyMailer.php Modified: branches/0.9-dev/framework/Bee/Utils/SmartyMailer.php =================================================================== --- branches/0.9-dev/framework/Bee/Utils/SmartyMailer.php 2014-09-03 11:30:09 UTC (rev 207) +++ branches/0.9-dev/framework/Bee/Utils/SmartyMailer.php 2014-09-07 09:42:46 UTC (rev 208) @@ -64,7 +64,10 @@ public function logMail($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) { $phpMailer = $this->instantiatePhpMailer($subjectTemplate, $bodyTemplate, $model, $recipient, $sender); if($this->messageLogFile && $phpMailer->preSend()) { - file_put_contents($this->messageLogFile, $phpMailer->getMailMIME()); + $message = $phpMailer->getMailMIME() . "\n\n"; + $message .= $phpMailer->Subject . "\n\n"; + $message .= $phpMailer->Body . "\n\n"; + file_put_contents($this->messageLogFile, $message); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-09-03 11:30:19
|
Revision: 207 http://sourceforge.net/p/beeframework/code/207 Author: m_plomer Date: 2014-09-03 11:30:09 +0000 (Wed, 03 Sep 2014) Log Message: ----------- - backports from 0.10 trunk Modified Paths: -------------- branches/0.9-dev/framework/Bee/MVC/View/JsonService.php branches/0.9-dev/framework/Bee/Utils/SmartyMailer.php Modified: branches/0.9-dev/framework/Bee/MVC/View/JsonService.php =================================================================== --- branches/0.9-dev/framework/Bee/MVC/View/JsonService.php 2014-09-03 10:48:57 UTC (rev 206) +++ branches/0.9-dev/framework/Bee/MVC/View/JsonService.php 2014-09-03 11:30:09 UTC (rev 207) @@ -22,12 +22,8 @@ */ class Bee_MVC_View_JsonService extends Bee_MVC_View_Abstract { -// protected function prepareResponse() { -// } - /** - * @Return void - * @Param model Array + * */ protected function renderMergedOutputModel() { echo json_encode(Bee_MVC_Model::getModelValues()); Modified: branches/0.9-dev/framework/Bee/Utils/SmartyMailer.php =================================================================== --- branches/0.9-dev/framework/Bee/Utils/SmartyMailer.php 2014-09-03 10:48:57 UTC (rev 206) +++ branches/0.9-dev/framework/Bee/Utils/SmartyMailer.php 2014-09-03 11:30:09 UTC (rev 207) @@ -1,6 +1,6 @@ <?php /* - * Copyright 2008-2010 the original author or authors. + * Copyright 2008-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,13 +30,21 @@ */ private $smarty; - /** - * @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" - */ + /** + * @var string + */ + private $messageLogFile; + + /** + * @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 + * @throws phpmailerException + * @return bool + */ public function sendMail($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) { $phpMailer = $this->instantiatePhpMailer($subjectTemplate, $bodyTemplate, $model, $recipient, $sender); @@ -46,6 +54,20 @@ return true; } + /** + * @param $subjectTemplate + * @param $bodyTemplate + * @param array $model + * @param null $recipient + * @param null $sender + */ + public function logMail($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) { + $phpMailer = $this->instantiatePhpMailer($subjectTemplate, $bodyTemplate, $model, $recipient, $sender); + if($this->messageLogFile && $phpMailer->preSend()) { + file_put_contents($this->messageLogFile, $phpMailer->getMailMIME()); + } + } + /** * @param $subjectTemplate * @param $bodyTemplate @@ -136,4 +158,18 @@ public final function setSmarty(Smarty $smarty) { $this->smarty = $smarty; } + + /** + * @return string + */ + public function getMessageLogFile() { + return $this->messageLogFile; + } + + /** + * @param string $messageLogFile + */ + public function setMessageLogFile($messageLogFile) { + $this->messageLogFile = $messageLogFile; + } } \ 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...> - 2014-09-03 10:49:01
|
Revision: 206 http://sourceforge.net/p/beeframework/code/206 Author: m_plomer Date: 2014-09-03 10:48:57 +0000 (Wed, 03 Sep 2014) Log Message: ----------- - SmartyMailer: added mail logging function Modified Paths: -------------- trunk/framework/Bee/Utils/SmartyMailer.php Modified: trunk/framework/Bee/Utils/SmartyMailer.php =================================================================== --- trunk/framework/Bee/Utils/SmartyMailer.php 2014-08-30 15:50:47 UTC (rev 205) +++ trunk/framework/Bee/Utils/SmartyMailer.php 2014-09-03 10:48:57 UTC (rev 206) @@ -30,13 +30,21 @@ */ private $smarty; - /** - * @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" - */ + /** + * @var string + */ + private $messageLogFile; + + /** + * @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 + * @throws phpmailerException + * @return bool + */ public function sendMail($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) { $phpMailer = $this->instantiatePhpMailer($subjectTemplate, $bodyTemplate, $model, $recipient, $sender); @@ -46,6 +54,20 @@ return true; } + /** + * @param $subjectTemplate + * @param $bodyTemplate + * @param array $model + * @param null $recipient + * @param null $sender + */ + public function logMail($subjectTemplate, $bodyTemplate, array $model, $recipient=null, $sender=null) { + $phpMailer = $this->instantiatePhpMailer($subjectTemplate, $bodyTemplate, $model, $recipient, $sender); + if($this->messageLogFile && $phpMailer->preSend()) { + file_put_contents($this->messageLogFile, $phpMailer->getMailMIME()); + } + } + /** * @param $subjectTemplate * @param $bodyTemplate @@ -136,4 +158,18 @@ public final function setSmarty(Smarty $smarty) { $this->smarty = $smarty; } + + /** + * @return string + */ + public function getMessageLogFile() { + return $this->messageLogFile; + } + + /** + * @param string $messageLogFile + */ + public function setMessageLogFile($messageLogFile) { + $this->messageLogFile = $messageLogFile; + } } \ 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...> - 2014-08-30 15:50:52
|
Revision: 205 http://sourceforge.net/p/beeframework/code/205 Author: m_plomer Date: 2014-08-30 15:50:47 +0000 (Sat, 30 Aug 2014) Log Message: ----------- - D2 EnumType: fixed compatibility with early 5.3 version (which exhibit quirks in reflected access to late statically bound methods) - MVC: fixed bug in BasicViewResolver that essentially disabled json view resolution Modified Paths: -------------- trunk/framework/Bee/MVC/ViewResolver/BasicViewResolver.php trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php Modified: trunk/framework/Bee/MVC/ViewResolver/BasicViewResolver.php =================================================================== --- trunk/framework/Bee/MVC/ViewResolver/BasicViewResolver.php 2014-08-29 16:47:25 UTC (rev 204) +++ trunk/framework/Bee/MVC/ViewResolver/BasicViewResolver.php 2014-08-30 15:50:47 UTC (rev 205) @@ -86,7 +86,7 @@ $modifiedViewName = $this->modifyViewName($viewName, $request); if ($modifiedViewName != $viewName) { try { - return $this->getViewForName($viewName); + return $this->getViewForName($modifiedViewName); } catch (Bee_Context_BeansException $bex) { if($this->getLog()->isDebugEnabled()) { $this->getLog()->debug('Modified view name "' . $modifiedViewName . '" not found, trying base bean name "' . $viewName . '"', $bex); Modified: trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php =================================================================== --- trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php 2014-08-29 16:47:25 UTC (rev 204) +++ trunk/framework/Bee/Persistence/Doctrine2/Types/EnumType.php 2014-08-30 15:50:47 UTC (rev 205) @@ -42,7 +42,7 @@ if (!$this->reflClass) self::init(); $values = array_map(function ($val) { return "'" . $val . "'"; - }, $this->reflClass->getMethod('getValues')->invoke(null)); + }, call_user_func(array(static::getEnumClassName(), 'getValues'))); return "ENUM(" . implode(", ", $values) . ") COMMENT '(DC2Type:" . $this->getName() . ")'"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <m_p...@us...> - 2014-08-29 16:47:33
|
Revision: 204 http://sourceforge.net/p/beeframework/code/204 Author: m_plomer Date: 2014-08-29 16:47:25 +0000 (Fri, 29 Aug 2014) Log Message: ----------- - ported latest auth fixes from 0.9 branch to trunk Modified Paths: -------------- trunk/framework/Bee/MVC/View/JsonService.php trunk/framework/Bee/Security/AbstractAuthenticationManager.php trunk/framework/Bee/Security/AbstractAuthenticationToken.php trunk/framework/Bee/Security/IAuthentication.php trunk/framework/Bee/Security/IAuthenticationProvider.php trunk/framework/Bee/Security/Provider/AbstractUserDetailsAuthentication.php trunk/framework/Bee/Security/Provider/AnonymousAuthentication.php trunk/framework/Bee/Security/Provider/DaoAuthentication.php trunk/framework/Bee/Security/Provider/Manager.php trunk/framework/Bee/Security/UsernamePasswordAuthenticationToken.php Modified: trunk/framework/Bee/MVC/View/JsonService.php =================================================================== --- trunk/framework/Bee/MVC/View/JsonService.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/MVC/View/JsonService.php 2014-08-29 16:47:25 UTC (rev 204) @@ -33,5 +33,3 @@ echo json_encode(Bee_MVC_Model::getModelValues()); } } - -?> \ No newline at end of file Modified: trunk/framework/Bee/Security/AbstractAuthenticationManager.php =================================================================== --- trunk/framework/Bee/Security/AbstractAuthenticationManager.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/AbstractAuthenticationManager.php 2014-08-29 16:47:25 UTC (rev 204) @@ -20,14 +20,14 @@ /** * Enter description here... * - * @var booelan + * @var boolean */ private $clearExtraInformation; public final function authenticate(Bee_Security_IAuthentication $authentication) { try { return $this->doAuthentication($authentication); - } catch (Bee_Security_AuthenticationException $e) { + } catch (Bee_Security_Exception_Authentication $e) { $e->setAuthentication($authentication); if ($this->clearExtraInformation) { @@ -43,7 +43,7 @@ * * @param Bee_Security_IAuthentication $authentication * - * @throws Bee_Security_AuthenticationException + * @throws Bee_Security_Exception_Authentication */ protected abstract function doAuthentication(Bee_Security_IAuthentication $authentication); @@ -60,5 +60,4 @@ $this->clearExtraInformation = $clearExtraInformation; } -} -?> \ No newline at end of file +} \ No newline at end of file Modified: trunk/framework/Bee/Security/AbstractAuthenticationToken.php =================================================================== --- trunk/framework/Bee/Security/AbstractAuthenticationToken.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/AbstractAuthenticationToken.php 2014-08-29 16:47:25 UTC (rev 204) @@ -79,6 +79,4 @@ } return $principal; } - -} -?> \ No newline at end of file +} \ No newline at end of file Modified: trunk/framework/Bee/Security/IAuthentication.php =================================================================== --- trunk/framework/Bee/Security/IAuthentication.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/IAuthentication.php 2014-08-29 16:47:25 UTC (rev 204) @@ -73,5 +73,9 @@ * @return void */ function setAuthenticated($authenticated); -} -?> \ No newline at end of file + + /** + * @return string + */ + function getName(); +} \ No newline at end of file Modified: trunk/framework/Bee/Security/IAuthenticationProvider.php =================================================================== --- trunk/framework/Bee/Security/IAuthenticationProvider.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/IAuthenticationProvider.php 2014-08-29 16:47:25 UTC (rev 204) @@ -31,7 +31,7 @@ * <code>Authentication</code> object. In such a case, the next <code>AuthenticationProvider</code> that * supports the presented <code>Authentication</code> class will be tried. * - * @throws Bee_Security_AuthenticationException if authentication fails. + * @throws Bee_Security_Exception_Authentication if authentication fails. */ function authenticate(Bee_Security_IAuthentication $authentication); @@ -43,4 +43,3 @@ */ function supports($authenticationClass); } -?> \ No newline at end of file Modified: trunk/framework/Bee/Security/Provider/AbstractUserDetailsAuthentication.php =================================================================== --- trunk/framework/Bee/Security/Provider/AbstractUserDetailsAuthentication.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/Provider/AbstractUserDetailsAuthentication.php 2014-08-29 16:47:25 UTC (rev 204) @@ -41,7 +41,7 @@ * @param Bee_Security_IUserDetails $userDetails * @param Bee_Security_UsernamePasswordAuthenticationToken $authentication * - * @throws Bee_Security_AuthenticationException + * @throws Bee_Security_Exception_Authentication */ protected abstract function additionalAuthenticationChecks(Bee_Security_IUserDetails $userDetails, Bee_Security_UsernamePasswordAuthenticationToken $authentication); @@ -67,12 +67,17 @@ } } - /** - * Enter description here... - * - * @param Bee_Security_IAuthentication $authentication - * @return Bee_Security_IAuthentication - */ + /** + * Enter description here... + * + * @param Bee_Security_IAuthentication $authentication + * @throws Bee_Security_Exception_AccountStatus + * @throws Bee_Security_Exception_Authentication + * @throws Bee_Security_Exception_BadCredentials + * @throws Bee_Security_Exception_UsernameNotFound + * @throws Exception + * @return Bee_Security_IAuthentication + */ public final function authenticate(Bee_Security_IAuthentication $authentication) { Bee_Utils_Assert::isInstanceOf('Bee_Security_UsernamePasswordAuthenticationToken', $authentication, 'Only UsernamePasswordAuthenticationToken is supported'); @@ -109,7 +114,7 @@ if ($cacheWasUsed) { // There was a problem, so try again after checking // we're using latest data (ie not from the cache) - $cacheWasUsed = false; +// $cacheWasUsed = false; $user = $this->retrieveUser($username, $authentication); $this->additionalAuthenticationChecks($user, $authentication); } else { @@ -138,12 +143,12 @@ * <p>Subclasses will usually store the original credentials the user supplied (not salted or encoded * passwords) in the returned <code>Bee_Security_IAuthentication</code> object.</p> * - * @param principal that should be the principal in the returned object (defined by the {@link + * @param mixed $principal that should be the principal in the returned object (defined by the {@link * #isForcePrincipalAsString()} method) - * @param authentication that was presented to the provider for validation - * @param user that was loaded by the implementation + * @param Bee_Security_IAuthentication $authentication that was presented to the provider for validation + * @param Bee_Security_IUserDetails $user that was loaded by the implementation * - * @return the successful authentication token + * @return Bee_Security_UsernamePasswordAuthenticationToken the successful authentication token */ protected function createSuccessAuthentication($principal, Bee_Security_IAuthentication $authentication, Bee_Security_IUserDetails $user) { // Ensure we return the original credentials the user supplied, @@ -231,6 +236,4 @@ public function setForcePrincipalAsString($forcePrincipalAsString) { $this->forcePrincipalAsString = $forcePrincipalAsString; } - } -?> \ No newline at end of file Modified: trunk/framework/Bee/Security/Provider/AnonymousAuthentication.php =================================================================== --- trunk/framework/Bee/Security/Provider/AnonymousAuthentication.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/Provider/AnonymousAuthentication.php 2014-08-29 16:47:25 UTC (rev 204) @@ -22,7 +22,6 @@ * Time: 9:10:57 PM * To change this template use File | Settings | File Templates. */ - class Bee_Security_Provider_AnonymousAuthentication implements Bee_Security_IAuthenticationProvider { private $key; @@ -33,6 +32,7 @@ if (!$this->supports($authentication)) { return null; } + /** @var Bee_Security_AnonymousAuthenticationToken $authentication */ if (hash('md5', $this->key) != $authentication->getKeyHash()) { throw new Bee_Security_Exception_BadCredentials('The presented AnonymousAuthenticationToken does not contain the expected key'); @@ -53,4 +53,3 @@ return Bee_Utils_Types::isAssignable($authenticationClass, 'Bee_Security_AnonymousAuthenticationToken'); } } -?> \ No newline at end of file Modified: trunk/framework/Bee/Security/Provider/DaoAuthentication.php =================================================================== --- trunk/framework/Bee/Security/Provider/DaoAuthentication.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/Provider/DaoAuthentication.php 2014-08-29 16:47:25 UTC (rev 204) @@ -137,4 +137,3 @@ $this->userDetailsService = $userDetailsService; } } -?> \ No newline at end of file Modified: trunk/framework/Bee/Security/Provider/Manager.php =================================================================== --- trunk/framework/Bee/Security/Provider/Manager.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/Provider/Manager.php 2014-08-29 16:47:25 UTC (rev 204) @@ -28,7 +28,7 @@ /** * Enter description here... * - * @var array + * @var Bee_Security_IAuthenticationProvider[] */ private $providers = array(); @@ -128,5 +128,4 @@ public final function setSessionController(Bee_Security_Concurrent_ISessionController $sessionController) { $this->sessionController = $sessionController; } -} -?> \ No newline at end of file +} \ No newline at end of file Modified: trunk/framework/Bee/Security/UsernamePasswordAuthenticationToken.php =================================================================== --- trunk/framework/Bee/Security/UsernamePasswordAuthenticationToken.php 2014-08-29 16:30:19 UTC (rev 203) +++ trunk/framework/Bee/Security/UsernamePasswordAuthenticationToken.php 2014-08-29 16:47:25 UTC (rev 204) @@ -20,42 +20,42 @@ * */ class Bee_Security_UsernamePasswordAuthenticationToken extends Bee_Security_AbstractAuthenticationToken { - - private $credentials; - private $principal; - - /** - * Enter description here... - * - * @param mixed $principal - * @param mixed $credentials - * @param Bee_Security_IGrantedAuthority[] $authorities - */ - public function __construct($principal, $credentials, $authorities = null) { - parent::__construct($authorities); - $this->principal = $principal; - $this->credentials = $credentials; - parent::setAuthenticated(!is_null($authorities) ? true : false); - } - + private $credentials; + + private $principal; + + /** + * Enter description here... + * + * @param mixed $principal + * @param mixed $credentials + * @param Bee_Security_IGrantedAuthority[] $authorities + */ + public function __construct($principal, $credentials, $authorities = null) { + parent::__construct($authorities); + $this->principal = $principal; + $this->credentials = $credentials; + + parent::setAuthenticated(!is_null($authorities) ? true : false); + } + public function getPrincipal() { return $this->principal; } - + public function getCredentials() { return $this->credentials; } - + public function setAuthenticated($authenticated) { - if ($authenticated) { - throw new Exception("Cannot set this token to trusted - use constructor containing granted authority[]s instead"); - } - parent::setAuthenticated(false); + if ($authenticated) { + throw new Exception("Cannot set this token to trusted - use constructor containing granted authority[]s instead"); + } + parent::setAuthenticated(false); } - public function __toString() { - return 'Bee_Security_UsernamePasswordAuthenticationToken['.$this->principal.']'; - } -} -?> \ No newline at end of file + public function __toString() { + return 'Bee_Security_UsernamePasswordAuthenticationToken[' . $this->principal . ']'; + } +} \ 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...> - 2014-08-29 16:30:22
|
Revision: 203 http://sourceforge.net/p/beeframework/code/203 Author: m_plomer Date: 2014-08-29 16:30:19 +0000 (Fri, 29 Aug 2014) Log Message: ----------- tagged latest changes in 0.9 branch Added Paths: ----------- tags/0.9.28/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |