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

Permission checking in templates #11

Open
davedx opened this issue Jan 1, 2014 · 7 comments
Open

Permission checking in templates #11

davedx opened this issue Jan 1, 2014 · 7 comments

Comments

@davedx
Copy link

davedx commented Jan 1, 2014

Hi there,

I'm using tags for a current project where we need to only allow owners of documents or admins to add or edit tags.

On the server side this was easy to implement as the tags package uses the standard Meteor "allow" method -- I just added the document to the callback and was then able to do my perm checking.

On the client side in the templates this seems less easy, as the tags seem to be alongside the delete and add buttons in one chunk of template. So I was thinking of modifying the template to somehow allow permission checking here too, so users do not think they can add/edit/delete when they actually cannot.

Do you have any suggestions on how to approach this? I'll submit a PR when I've got something useful. :)

@apendua
Copy link
Owner

apendua commented Jan 2, 2014

@davedx Good point, I will also think how to solve this problem. The first thing that comes to my mind is to use two different helpers like {{showTags}} and {{editTags}} and let you decide which one you want to use. Would it solve your problem?

@davedx
Copy link
Author

davedx commented Jan 3, 2014

@apendua I think that would work - it's probably the simplest solution too. I assume both would render all the tags, but only {{editTags}} would allow the editing controls (delete and add buttons)?

Maybe another option would be to parameterize it, e.g. {{showTags editable}} or {{showTags readonly}}?

@davedx
Copy link
Author

davedx commented Jan 27, 2014

@apendua I've done some work on this on our own fork, and was wondering if you'd be interested in a PR. Here's the compare: https://github.com/solvers/meteor-tags/compare

As you can see, as well as the permission changes we also removed the dependency on Bootstrap. This was necessary for us as we're using Bootstrap 3, and we couldn't have both versions present. Do you think this is acceptable?

(Of course we'd have to change the metadata back too before sending the PR :) )

@apendua
Copy link
Owner

apendua commented Jan 28, 2014

@davedx Thank you for these suggestions. I will have a look and prepare a dev branch so that you make a pull request against it. Sounds good to you?

@davedx
Copy link
Author

davedx commented Jan 28, 2014

Sounds good!

On Tue, Jan 28, 2014 at 12:52 PM, Tomasz Lenarcik
[email protected]:

@davedx https://github.com/davedx Thank you for these suggestions. I
will have a look and prepare a dev branch so that you make a pull request
against it. Sounds good to you?

Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-33471816
.

@apendua
Copy link
Owner

apendua commented Jan 29, 2014

@davedx Cool :) So dev branch is already there waiting for your PR.

@davedx
Copy link
Author

davedx commented Jan 29, 2014

PR sent!

On Wed, Jan 29, 2014 at 10:59 AM, Tomasz Lenarcik
[email protected]:

@davedx https://github.com/davedx Cool :) So dev branch is already
there waiting for your PR.

Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-33570452
.

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