nahoSecurityPlugin
0.1.0beta
for sf 1.2sf 1.1sf 1.0 MIT
This plugin is the first step of a larger project of ACL in Symfony, coupled
with sfGuardUser, which will offer a full interface to define access by
application/module/action.
The current release allows you to automatically add a dynamic credential to
your actions and modules.
Once the plugin enabled, you just have to set "is_secure" to on in your
application's security.yml, and each module/action will require the
credential "application.module.action".
Developers
License
Copyright (c) Nicolas Chambrier
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Releases for sf 1.2
| Version |
License |
API |
Released |
|
0.1.0beta
|
MIT license |
0.1.0beta
|
15/04/2009 |
Releases for sf 1.1
| Version |
License |
API |
Released |
|
0.1.0beta
|
MIT license |
0.1.0beta
|
15/04/2009 |
Releases for sf 1.0
| Version |
License |
API |
Released |
|
0.1.0beta
|
MIT license |
0.1.0beta
|
15/04/2009 |
Changelog for release 0.1.0 - 15/04/2009
- naholyr: first release, auto_credential features
Other releases
Release 0.1.0 - 15/04/2009
- naholyr: first release, auto_credential features
nahoSecurity plugin
This plugin is the first step of a larger project of ACL in Symfony, coupled
with sfGuardUser, which will offer a full interface to define access by
application/module/action.
The current release allows you to automatically add a dynamic credential to
your actions and modules.
Once the plugin enabled, you just have to set "is_secure" to on in your
application's security.yml, and each module/action will require the
credential "application.module.action".
Installation
Install the plugin
$ symfony plugin-install http://plugins.symfony-project.com/nahoSecurityPlugin
Clear you cache
$ symfony cc
Change the security filter class in filters.yml :
security:
class: nahoSecurityFilter
Whenever you have already changed this value (for example, if you use sfGuardPlugin,
branch 1.0, with the rememberMe feature enabled), see "Configuration" section below.
Configuration
See plugin's app.yml to get default configuration with comments :
all:
nahoSecurityPlugin:
# Set this to off to disable automatic credentials based on "auto_credential_format" option.
auto_credential: on
# Format of the automatic added credential : you can use %application%, %module% and %action% in this string
auto_credential_format:
application: "%application%"
module: "%application%.%module%"
action: "%application%.%module%.%action%"
# Related to auto_credential : allows to affect "negative credentials" to the user.
# Example : I have "frontend.example" and "!frontend.example.something" credentials,
# then I'll be able to access to all the "example" module's actions, except "something".
auto_credential_negate: "!"
# nahoSecurityFilter supports "dynamic inheritance", change this value to make it extend another class than the usual sfBasicSecurityFilter
# For example, if you use sfGuardPlugin with "remember me" filter, set this option to "sfGuardBasicSecurityFilter"
filter_base_class: "sfBasicSecurityFilter"
To disable the plugin's default behavior (automatically require "application.module.action" in each action), set
app_nahoSecurityPlugin_auto_credentials to off
Format of the automatic credentials can be customized per-level : define app_nahoSecurityPlugin_auto_credential_format formats
for each level : application, module, and action.
In these formats, you can use keywords that will be replaced by the current element's name :
%application% will be replaced by current application's name
%module% will be replaced by current module's name
%action% will be replaced by current action's name
The auto_credential_negate option defines the prefix that marks a credential as negative. Note that it cannot be stacked :
!permission will cancel permission, but !!permission will not cancel !permission.
If you already had a customized class for filter security, you just have to set filter_base_class to this value. This way, nahoSecurityFilter
will extend the given class (what I call "dynamic inheritance"), and simply allow you to use both features.
TODO
- nice grid/interface to define users' accesses.