From 6bba33d7e6fbb0cedc39f9a11f816fe5bd372ae7 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Wed, 17 Jul 2013 16:16:07 -0400 Subject: Whew. This is a big update. I did some significant keeping work. I moved all of the folders and enpoints labeled 'admin' to the more accurate term of 'moderat- ion.' I also created the ability for admins and moderators to add or remove pr- ivileges or to ban a user in response to a report. This also meant implementing the UserBan class in various places. I also had to add a column called result to the ReportBase table. This allows the moderator/admin to leave comments when they respond to a report, allowing for archiving of what responses they do/n't take. --\ mediagoblin/db/migrations.py --| Added result column to ReportBase --\ mediagoblin/db/models.py --| Added result column to ReportBase --| Added documentation to tables I had made previously --\ mediagoblin/decorators.py --| Editted the user_has_privilege decorator to check whether a user has been | banned or not --| Created a seperate user_not_banned decorator to prevent banned users from | accessing any pages --| Changed require_admin_login into require_admin_or_moderator login --\ mediagoblin/gmg_commands/users.py --| Made the gmg command `adduser` create a user w/ the appropriate privileges --\ mediagoblin/moderation/routing.py << formerly mediagoblin/admin/routing.py --| Renamed all of the routes from admin -> moderation --\ mediagoblin/routing.py --| Renamed all of the routes from admin -> moderation --\ mediagoblin/moderation/views.py << formerly mediagoblin/admin/views.py --| Renamed all of the routes & functions from admin -> moderation --| Expanded greatly on the moderation_reports_detail view and functionality --| Added in the give_or_take_away_privilege form, however this might be a use- | -less function which I could remove (because privilege changes should happe- | n in response to a report so they can be archived and visible) --\ mediagoblin/static/css/base.css --| Added in a style for the reports_detail page --\ mediagoblin/templates/mediagoblin/base.html --| Renamed all of the routes from admin -> moderation --\ mediagoblin/templates/mediagoblin/moderation/report.html --| Added form to allow moderators and admins to respond to reports. --\ mediagoblin/templates/mediagoblin/moderation/reports_panel.html --| Fixed the table for closed reports --\ mediagoblin/templates/mediagoblin/moderation/user.html --| Added in a table w/ all of the user's privileges and the option to add or | remove them. Again, this is probably vestigial --| Renamed all of the routes from admin -> moderation --\ mediagoblin/templates/mediagoblin/moderation/user_panel.html --| Renamed all of the routes from admin -> moderation --\ mediagoblin/tools/response.py --| Added function render_user_banned, this is the view function for the redir- | -ect that happens when a user tries to access the site whilst banned --\ mediagoblin/user_pages/forms.py --| Added important translate function where I had text --\ mediagoblin/user_pages/lib.py --| Renamed functiion for clarity --\ mediagoblin/user_pages/views.py --| Added the user_not_banned decorator to every view --\ mediagoblin/views.py --| Added the user_not_banned decorator --\ mediagoblin/moderation/forms.py --| Created this new file --\ mediagoblin/templates/mediagoblin/banned.html --| Created this new file --| This is the page which people are redirected to when they access the site | while banned --- mediagoblin/routing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mediagoblin/routing.py') diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py index a650f22f..0642ad8e 100644 --- a/mediagoblin/routing.py +++ b/mediagoblin/routing.py @@ -18,7 +18,7 @@ import logging from mediagoblin.tools.routing import add_route, mount, url_map from mediagoblin.tools.pluginapi import PluginManager -from mediagoblin.admin.routing import admin_routes +from mediagoblin.moderation.routing import moderation_routes from mediagoblin.auth.routing import auth_routes @@ -28,7 +28,7 @@ _log = logging.getLogger(__name__) def get_url_map(): add_route('index', '/', 'mediagoblin.views:root_view') mount('/auth', auth_routes) - mount('/a', admin_routes) + mount('/mod', moderation_routes) import mediagoblin.submit.routing import mediagoblin.user_pages.routing -- cgit v1.2.3 From 8394febbe1408030d1afa8f3961d92341eefa474 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Tue, 13 Aug 2013 18:38:00 -0400 Subject: This has been an update to clean out the code a little bit. The primary change I made was I added the method has_privilege (which takes a variable amount of unicode privilege names as an argument) to the User model. This method allowed for much cleaner checks as to whether or not a user has a privilege. Other- wise, I also made it impossible for moderators to punish admins. I created a new url path and three new pages for Users to look at filed reports and the code of conduct for the mg instance. === Made reports on admins not resolvable by moderators: --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/moderation/report.html === Created new files for the new pages: --\ mediagoblin/meta/__init__.py --\ mediagoblin/meta/routing.py --\ mediagoblin/meta/views.py --\ mediagoblin/templates/mediagoblin/meta/code_of_conduct.html --\ mediagoblin/templates/mediagoblin/meta/reports_details.html --\ mediagoblin/templates/mediagoblin/meta/reports_panel.html --\ mediagoblin/routing.py --\ mediagoblin/static/css/base.css === Replaced vestigial methods of checking a user's privilege with the more ====== effective method has_privilege(u'privilege_name'): --\ mediagoblin/db/models.py --| Added in the has_privilege method to the User class --\ mediagoblin/db/migrations.py --\ mediagoblin/db/models.py --\ mediagoblin/decorators.py --\ mediagoblin/edit/lib.py --\ mediagoblin/edit/views.py --\ mediagoblin/gmg_commands/users.py --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/base.html --\ mediagoblin/templates/mediagoblin/user_pages/collection.html --\ mediagoblin/templates/mediagoblin/user_pages/media.html --\ mediagoblin/templates/mediagoblin/user_pages/user.html --\ mediagoblin/templates/mediagoblin/utils/collection_gallery.html --\ mediagoblin/user_pages/views.py === Minor UI changes --\ mediagoblin/templates/mediagoblin/moderation/report_panel.html --\ mediagoblin/templates/mediagoblin/moderation/user.html === Other Bugs: --\ mediagoblin/tools/response.py --\ mediagoblin/db/migrations.py --- mediagoblin/routing.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mediagoblin/routing.py') diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py index c9377ad4..9686d103 100644 --- a/mediagoblin/routing.py +++ b/mediagoblin/routing.py @@ -20,6 +20,7 @@ from mediagoblin.tools.routing import add_route, mount, url_map from mediagoblin.tools.pluginapi import PluginManager from mediagoblin.moderation.routing import moderation_routes from mediagoblin.auth.routing import auth_routes +from mediagoblin.meta.routing import meta_routes _log = logging.getLogger(__name__) @@ -29,6 +30,7 @@ def get_url_map(): add_route('index', '/', 'mediagoblin.views:root_view') mount('/auth', auth_routes) mount('/mod', moderation_routes) + mount('/meta', meta_routes) import mediagoblin.submit.routing import mediagoblin.user_pages.routing @@ -37,6 +39,7 @@ def get_url_map(): import mediagoblin.listings.routing import mediagoblin.notifications.routing + for route in PluginManager().get_routes(): add_route(*route) -- cgit v1.2.3 From 6acf4ee60e3c07aea5bbd9e613335f0de1240d73 Mon Sep 17 00:00:00 2001 From: tilly-Q Date: Tue, 10 Sep 2013 13:16:22 -0400 Subject: This should be my final code update before I am ready for review! Basically, in this update I finished the search/sort function on the Reports Panel. I also finished the Terms of Service and made the decision to remove the meta portion of the site I had planned to create. I decided that the features involved were just unnecessary at this point. I also dropped the User status column and added a migration to establish default privileges (and create the privilege foundat- -ions. I fixed a few small errors that were left over as well, in the implemen- tation and in the tests. Next, I just need to await code review and work on the documentation for these new features. I also need to supervise a new merge to master. =============================================================================== Dropped the vestigial 'status' column =============================================================================== --\ mediagoblin/db/migrations.py --\ mediagoblin/db/models.py --| Also added in comments describing the current situation with the `is_admin` | and `email_verified` columns, where they are 100% vestigial but cannot be | dropped. =============================================================================== Wrote necessary migrations to set up Privilege foundations and give users the necessary privileges on an older implementation of mediagoblin that is migrating into this update =============================================================================== --\ mediagoblin/db/migrations.py =============================================================================== Deleted the meta pages =============================================================================== --\ Deleted mediagoblin/meta/__init__.py --\ Deleted mediagoblin/meta/routing.py --\ Deleted mediagoblin/meta/views.py --\ Deleted mediagoblin/templates/mediagoblin/meta/code_of_conduct.html --\ Deleted mediagoblin/templates/mediagoblin/meta/reports_details.html --\ Deleted mediagoblin/templates/mediagoblin/meta/reports_panel.html ---------------------------------------------------------------- Moved the terms of service to /terms_of_service ---------------------------------------------------------------- --\ Moved mediagoblin/templates/mediagoblin/meta/terms_of_service.html -> mediagoblin/templates/mediagoblin/terms_of_service.html --| I decided that terms of service were really the only necessary part of my | planned "meta" pages, so I moved it instead to its own singular page --\ mediagoblin/routing.py --\ mediagoblin/static/css/base.css --\ mediagoblin/templates/mediagoblin/base.html --\ mediagoblin/views.py =============================================================================== Simplified & Finished the Reports Panel Searching =============================================================================== --\ mediagoblin/moderation/forms.py --\ mediagoblin/moderation/tools.py --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/moderation/report_panel.html --\ mediagoblin/templates/mediagoblin/moderation/user.html =============================================================================== Fixed Small Errors =============================================================================== --\ mediagoblin/templates/mediagoblin/user_pages/user.html --\ mediagoblin/tests/test_moderation.py --\ mediagoblin/tests/tools.py =============================================================================== --- mediagoblin/routing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mediagoblin/routing.py') diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py index a9809c44..c2c6d284 100644 --- a/mediagoblin/routing.py +++ b/mediagoblin/routing.py @@ -20,7 +20,6 @@ from mediagoblin.tools.routing import add_route, mount, url_map from mediagoblin.tools.pluginapi import PluginManager from mediagoblin.moderation.routing import moderation_routes from mediagoblin.auth.routing import auth_routes -from mediagoblin.meta.routing import meta_routes _log = logging.getLogger(__name__) @@ -28,9 +27,10 @@ _log = logging.getLogger(__name__) def get_url_map(): add_route('index', '/', 'mediagoblin.views:root_view') + add_route('terms_of_service','/terms_of_service', + 'mediagoblin.views:terms_of_service') mount('/auth', auth_routes) mount('/mod', moderation_routes) - mount('/meta', meta_routes) import mediagoblin.submit.routing import mediagoblin.user_pages.routing -- cgit v1.2.3