Skip to content

Commit

Permalink
updated guide
Browse files Browse the repository at this point in the history
  • Loading branch information
dmeroff committed Jan 17, 2015
1 parent 41a54ea commit ba766f5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ Getting Started
---------------

- [Installation](installation.md)

Guides
------

- [Using custom auth manager](using-custom-auth-manager.md)
36 changes: 36 additions & 0 deletions docs/using-custom-auth-manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Using custom auth manager
=========================

Yii2-rbac provides special database auth manager that extends default manager provided by Yii. However in some projects
you may need to override in order to add some features that you need. Or you may want to use php files instead of database
to store auth data. In this case your class should implement interface `dektrium\rbac\components\ManagerInterface`:

```php

namespace app\components;

class MyManager extends \yii\rbac\PhpManager implements \dektrium\rbac\components\ManagerInterface
{
public function getItems($type = null, $excludeItems = [])
{
// you should implement this method or extend your class from \dektrium\rbac\components\DbManager
}

public function getItem($name)
{
// you should implement this method or extend your class from \dektrium\rbac\components\DbManager
}
}
```

After you created your class you should add it to your config file:

```php
[
'components' => [
'authManager' => [
'class' => 'app\components\MyManager',
],
],
]
```

0 comments on commit ba766f5

Please sign in to comment.