Skip to content

Commit

Permalink
Merge 24d5bf1 into 1f8b65a
Browse files Browse the repository at this point in the history
  • Loading branch information
leeqvip committed Oct 21, 2019
2 parents 1f8b65a + 24d5bf1 commit 3e15a5e
Show file tree
Hide file tree
Showing 11 changed files with 342 additions and 337 deletions.
6 changes: 3 additions & 3 deletions src/Enforcer.php
Expand Up @@ -209,10 +209,10 @@ public function initWithModelAndAdapter(Model $m, Adapter $adapter = null): void
$this->fm = Model::loadFunctionMap();

$this->initialize();

// Do not initialize the full policy when using a filtered adapter
$ok = $this->adapter instanceof FilteredAdapter ? $this->adapter->isFiltered() : false;

if (!\is_null($this->adapter) && !$ok) {
$this->loadPolicy();
}
Expand Down Expand Up @@ -337,12 +337,12 @@ public function clearPolicy(): void
public function loadPolicy(): void
{
$this->model->clearPolicy();

try {
$this->adapter->loadPolicy($this->model);
} catch (InvalidFilePathException $e) {
//throw $e;
}


$this->model->printPolicy();
if ($this->autoBuildRoleLinks) {
Expand Down
28 changes: 14 additions & 14 deletions src/Exceptions/CannotSaveFilteredPolicy.php
@@ -1,14 +1,14 @@
<?php

declare(strict_types=1);

namespace Casbin\Exceptions;

/**
* Class CannotSaveFilteredPolicy.
*
* @author techlee@qq.com
*/
class CannotSaveFilteredPolicy extends CasbinException
{
}
<?php

declare(strict_types=1);

namespace Casbin\Exceptions;

/**
* Class CannotSaveFilteredPolicy.
*
* @author techlee@qq.com
*/
class CannotSaveFilteredPolicy extends CasbinException
{
}
28 changes: 14 additions & 14 deletions src/Exceptions/InvalidFilePathException.php
@@ -1,14 +1,14 @@
<?php

declare(strict_types=1);

namespace Casbin\Exceptions;

/**
* Class InvalidFilePathException.
*
* @author techlee@qq.com
*/
class InvalidFilePathException extends CasbinException
{
}
<?php

declare(strict_types=1);

namespace Casbin\Exceptions;

/**
* Class InvalidFilePathException.
*
* @author techlee@qq.com
*/
class InvalidFilePathException extends CasbinException
{
}
28 changes: 14 additions & 14 deletions src/Exceptions/InvalidFilterTypeException.php
@@ -1,14 +1,14 @@
<?php

declare(strict_types=1);

namespace Casbin\Exceptions;

/**
* Class InvalidFilterTypeException.
*
* @author techlee@qq.com
*/
class InvalidFilterTypeException extends CasbinException
{
}
<?php

declare(strict_types=1);

namespace Casbin\Exceptions;

/**
* Class InvalidFilterTypeException.
*
* @author techlee@qq.com
*/
class InvalidFilterTypeException extends CasbinException
{
}
2 changes: 1 addition & 1 deletion src/Model/Model.php
Expand Up @@ -106,7 +106,7 @@ private function getKeySuffix(int $i): string
private function loadSection(ConfigContract $cfg, string $sec): void
{
$i = 1;
for (;;) {
for (; ;) {
if (!$this->loadAssertion($cfg, $sec, $sec.$this->getKeySuffix($i))) {
break;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Persist/AdapterHelper.php
Expand Up @@ -34,7 +34,7 @@ public function loadPolicyLine(string $line, Model $model): void
if (!isset($model[$sec][$key])) {
return;
}

$assertions = $model[$sec];
$assertions[$key]->policy[] = \array_slice($tokens, 1);
$model[$sec] = $assertions;
Expand Down

0 comments on commit 3e15a5e

Please sign in to comment.