re #108 use app main logger + multiple fixes

This commit is contained in:
Antonio Ramirez
2017-11-12 21:58:48 +01:00
parent 77430fbb74
commit 190fafa5f1
30 changed files with 100 additions and 63 deletions

View File

@ -56,7 +56,7 @@ class AuthHelper
? Yii::$app->getUser()->can($module->administratorPermissionName)
: false;
return $hasAdministratorPermissionName || in_array($username, $module->administrators);
return $hasAdministratorPermissionName || in_array($username, $module->administrators, false);
}
/**
@ -99,7 +99,7 @@ class AuthHelper
public function getUnassignedItems(AbstractAuthItem $model)
{
$excludeItems = $model->item !== null ? [$model->item->name] : [];
$type = $model->getType() == Permission::TYPE_PERMISSION ? Permission::TYPE_PERMISSION : null;
$type = $model->getType() === Permission::TYPE_PERMISSION ? Permission::TYPE_PERMISSION : null;
$items = $this->getAuthManager()->getItems($type, $excludeItems);
return ArrayHelper::map(

View File

@ -11,14 +11,6 @@
namespace Da\User\Helper;
/**
* ModelMapHelper.php.
*
* Date: 3/12/16
* Time: 18:10
*
* @author Antonio Ramirez <hola@2amigos.us>
*/
class ClassMapHelper
{
protected $map = [];

View File

@ -19,6 +19,8 @@ class MigrationHelper
* @param string $driverName
*
* @return null|string
*
* @throws RuntimeException
*/
public static function resolveTableOptions($driverName)
{
@ -39,6 +41,8 @@ class MigrationHelper
* @param $driverName
*
* @return string
*
* @throws RuntimeException
*/
public static function resolveDbType($driverName)
{
@ -60,9 +64,11 @@ class MigrationHelper
* @param string $driverName
*
* @return bool
*
* @throws RuntimeException
*/
public static function isMicrosoftSQLServer($driverName)
{
return self::resolveDbType($driverName) == 'sqlsrv';
return self::resolveDbType($driverName) === 'sqlsrv';
}
}

View File

@ -11,6 +11,7 @@
namespace Da\User\Helper;
use yii\base\Exception;
use yii\base\Security;
class SecurityHelper
@ -32,12 +33,23 @@ class SecurityHelper
* @param null|int $cost
*
* @return string
*
* @throws Exception
*/
public function generatePasswordHash($password, $cost = null)
{
return $this->security->generatePasswordHash($password, $cost);
}
/**
* Generates a random string
*
* @param int $length
*
* @return string
*
* @throws Exception
*/
public function generateRandomString($length = 32)
{
return $this->security->generateRandomString($length);

View File

@ -13,6 +13,7 @@ namespace Da\User\Helper;
use DateTime;
use DateTimeZone;
use yii\base\InvalidParamException;
use yii\helpers\ArrayHelper;
class TimezoneHelper
@ -21,6 +22,8 @@ class TimezoneHelper
* Get all of the time zones with the offsets sorted by their offset.
*
* @return array
*
* @throws InvalidParamException
*/
public static function getAll()
{