Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@role('admin') #4

Closed
fearrr opened this issue Oct 6, 2016 · 10 comments
Closed

@role('admin') #4

fearrr opened this issue Oct 6, 2016 · 10 comments

Comments

@fearrr
Copy link
Contributor

fearrr commented Oct 6, 2016

@ROLE('admin')

get ErrorException
Parse error: syntax error, unexpected ''admin'' (T_CONSTANT_ENCAPSED_STRING) (View: ...

@fearrr
Copy link
Contributor Author

fearrr commented Oct 6, 2016

To do this we have to use @role(('admin'))

@fearrr
Copy link
Contributor Author

fearrr commented Oct 6, 2016

But this construction does not work @ROLE(('moderator|admin'))

@klaravel
Copy link
Owner

klaravel commented Oct 6, 2016

It's fixed. Thank you.
Can you please update latest version and let me know if it's work for you?

@fearrr
Copy link
Contributor Author

fearrr commented Oct 6, 2016

sure

@fearrr
Copy link
Contributor Author

fearrr commented Oct 6, 2016

@ROLE('admin') Now it works.
Only one part can be used in Blade directive?

@klaravel
Copy link
Owner

klaravel commented Oct 6, 2016

There are total three blade directives.
Are you asking about that or something else?

@role('admin')
    <p>This is visible to users with the admin role. Gets translated to 
    \Ntrust::role('admin')</p>
@endrole

@permission('manage-admins')
    <p>This is visible to users with the given permissions. Gets translated to 
    \Ntrust::can('manage-admins'). The @can directive is already taken by core 
    laravel authorization package, hence the @permission directive instead.</p>
@endpermission

@ability('admin,owner', 'create-post,edit-user')
    <p>This is visible to users with the given abilities. Gets translated to 
    \Ntrust::ability('admin,owner', 'create-post,edit-user')</p>
@endability

Also let me know if you think any feature missing.

@fearrr
Copy link
Contributor Author

fearrr commented Oct 6, 2016

I mean, available use of multiple roles for the @ROLE directive in Blade (explode() function)
For example @role('admin|owner|moderator')

@klaravel
Copy link
Owner

klaravel commented Oct 6, 2016

You can use like below role with or condition.

@ability('admin,owner,moderator', '')
This user has at least one role from admin, editor or moderator.
@endrole

@klaravel klaravel closed this as completed Oct 7, 2016
@fearrr
Copy link
Contributor Author

fearrr commented Oct 7, 2016

Thanks, sorry for my carelessness.

@klaravel
Copy link
Owner

klaravel commented Oct 9, 2016

@fearrr

You can use like below.

@role(['superadmin', 'user'])
This should have role 'superadmin' or 'user'.
@endrole
@role(['superadmin', 'user'], true)
This should have both role 'superadmin' and 'user'.
@endrole

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants