noiselabs / SmartyBundle

Smarty3 template engine bundle for Symfony
http://smartybundle.readthedocs.io/
GNU Lesser General Public License v3.0
51 stars 36 forks source link

Intergrate security module #6

Closed kimhemsoe closed 12 years ago

kimhemsoe commented 12 years ago

Lets discuss how the plugins should look like

Suggestions to start from:

{if {is_granted role='IS_AUTHENTICATED_FULLY'}} // easy to understand but the extra {} is ugly. Params: role, roles, object, field

{if 'IS_AUTHENTICATED_FULLY'|is_granted} not great with $object and $field

$app also works ofc {if $app->getSecurity()->isGranted('IS_AUTHENTICATED_FULLY')}

None of them is really great

What do you think ?

vitorbrandao commented 12 years ago

Had GitGub notifications off and missed your comment, sorry. I'll look into this after I fix the translation tests.

vitorbrandao commented 12 years ago

None of them is really great

True.

Just sent an email to the smarty-discussion ml to hopefully get more suggestions (it was not approved by the moderators yet).

From the options you suggested I'm a little biased towards the modifier option. In the meantime I'm writing some code to support a SecurityExtension until we reach a decision.

vitorbrandao commented 12 years ago

SecurityExtension is now available in the security-extension branch, if you want to try it. I'll merge it to master soon nevertheless.

kimhemsoe commented 12 years ago

Looks good, more or less the same ive added to our custom smarty extensions inside our app bundle. Except ive never added support for other then the role tho

vitorbrandao commented 12 years ago

Just merged security-extension into main branch. A modifier is currently used. I'm closing this issue, if you see problems using the extension just re-open it.