diff options
author | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-07-03 14:46:21 -0400 |
---|---|---|
committer | tilly-Q <nattilypigeonfowl@gmail.com> | 2013-07-03 14:46:21 -0400 |
commit | 3fb96fc97800ae032e599006e3f49ffd69926c88 (patch) | |
tree | 93c19ff89864f065cb8fea5a313d76a1f8c09c0b /mediagoblin/user_pages/views.py | |
parent | 9b8ef022ef874304fb3d5aead612ec3b8fb23e9a (diff) | |
download | mediagoblin-3fb96fc97800ae032e599006e3f49ffd69926c88.tar.lz mediagoblin-3fb96fc97800ae032e599006e3f49ffd69926c88.tar.xz mediagoblin-3fb96fc97800ae032e599006e3f49ffd69926c88.zip |
This was a simple commit. I changed all references to Groups into Privileges so
as to not conflict with the new federated groups which are also being written.
I also fixed up some of the code in the user_in_group/user_has_privilege decor-
ator. Users are now assigned the default privileges when they sign up, and ass-
iged active once they are activated. I updated the gmg command makeadmin to use
my groups as well. Lastly, I added the decorator to various views, requiring th-
at users belong to appropriate groups to access pages.
--\ mediagoblin/auth/tools.py
--| Added code to assign new users to default privileges
--\ mediagoblin/auth/views.py
--| Added code to assign users to u'active' privilege once the email
| verification is complete
--\ mediagoblin/db/migrations.py
--| Renamed Group class to Privilege class
--\ mediagoblin/db/models.py
--| Renamed Group class to Privilege class
--\ mediagoblin/decorators.py
--| Renamed function based on the Group->Privilege change
--| Rewrote the function to be, ya know, functional
--\ mediagoblin/gmg_commands/users.py
--| Changed the 'makeadmin' command to add the target user to the admin
| privilege group as well as affecting 'is_admin' column
--\ mediagoblin/submit/views.py
--| Added the requirement that a user has the 'uploader' privilege in order
| to submit new media.
--\ mediagoblin/user_pages/views.py
--| Added the requirement that a user has the 'commenter' privilege in order
| to make a comment.
--| Added the requirement that a user has the 'reporter' privilege in order
| to submit new reports.
--| Got rid of some vestigial code in the file_a_report function.
Diffstat (limited to 'mediagoblin/user_pages/views.py')
-rw-r--r-- | mediagoblin/user_pages/views.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index a0eb67db..abf5e5c1 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -20,7 +20,7 @@ import datetime from mediagoblin import messages, mg_globals from mediagoblin.db.models import (MediaEntry, MediaTag, Collection, CollectionItem, User, MediaComment, - CommentReport, MediaReport, Group) + CommentReport, MediaReport) from mediagoblin.tools.response import render_to_response, render_404, \ redirect, redirect_obj from mediagoblin.tools.translate import pass_to_ugettext as _ @@ -30,7 +30,7 @@ from mediagoblin.user_pages.lib import (send_comment_email, build_report_form, add_media_to_collection) from mediagoblin.decorators import (uses_pagination, get_user_media_entry, - get_media_entry_by_id, user_in_group, + get_media_entry_by_id, user_has_privilege, require_active_login, user_may_delete_media, user_may_alter_collection, get_user_collection, get_user_collection_item, active_user_from_url, get_media_comment_by_id) @@ -152,6 +152,7 @@ def media_home(request, media, page, **kwargs): @get_media_entry_by_id @require_active_login +@user_has_privilege(u'commenter') def media_post_comment(request, media): """ recieves POST from a MediaEntry() comment form, saves the comment. @@ -621,8 +622,8 @@ def processing_panel(request): @require_active_login @get_user_media_entry -@user_in_group(u'reporter') -def file_a_report(request, media, comment=None, required_group=1): +@user_has_privilege(u'reporter') +def file_a_report(request, media, comment=None): if request.method == "POST": report_form = build_report_form(request.form) report_form.save() |