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

Discriminate which user can vote #209

Open
Alejoss opened this issue Feb 3, 2021 · 1 comment
Open

Discriminate which user can vote #209

Alejoss opened this issue Feb 3, 2021 · 1 comment

Comments

@Alejoss
Copy link

Alejoss commented Feb 3, 2021

Hi all. I think there is a very important use case that is not addressed by this lbry, how can one discriminate which user can vote? In my case, I need to make sure only users with a "certificate" can vote on the course rating (other users haven't taken the course, they shouldn't be able to vote). How can I achieve that, the template tag doesn't receive any useful argument for this. There is an editable template variable but no docs on how/where to set it to false.

@jamesoutterside
Copy link
Contributor

Hi @Alejoss

Thanks for the report, that does sound like a useful feature to add.

I think it could be answered a couple of ways, either via overriding editable in the template to check for a permission, or perhaps a more generic solution would be to amend how editable is used within ratings.py

'editable': not read_only and (is_authenticated(request.user) or app_settings.STAR_RATINGS_ANONYMOUS),

Adding a variable along the lines of STAR_RATINGS_PERMISSIONS_CHECK to allow users to specify a path to a function that takes a user and checks permissions (falling back to is_authenticated).

If this is something you are looking into we'd be happy to accept a PR.

Thanks

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

No branches or pull requests

2 participants