• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

php-casbin / yii-permission / 10457048672

19 Aug 2024 04:17PM UTC coverage: 92.056% (-0.1%) from 92.179%
10457048672

Pull #18

github

web-flow
Merge b99acac76 into c8cb31b23
Pull Request #18: feat: Add Yii authorization integration with AuthManager and Behaviors methods(#7)

32 of 35 new or added lines in 3 files covered. (91.43%)

197 of 214 relevant lines covered (92.06%)

41.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/components/PermissionChecker.php
1
<?php
2

3
namespace yii\permission\components;
4

5
use Yii;
6
use yii\rbac\CheckAccessInterface;
7

8
class PermissionChecker implements CheckAccessInterface
9
{
10
    /**
11
     * Checks if the user has access to a certain policy.
12
     *
13
     * @param int $userId The ID of the user to check.
14
     * @param string $policy The policy to check access for.
15
     * @param array $guards Optional guards to check, not supported yet.
16
     *
17
     * @return bool Whether the user has access to the policy.
18
     */
19
    public function checkAccess($userId, $policy, $guards = [])
20
    {
21
        $params = explode(',', $policy);
40✔
22
        if (empty($guards)) {
40✔
23
            return Yii::$app->permission->enforce($userId, ...$params);
40✔
24
        }
NEW
25
        return false;
×
26
    }
27
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc