aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/decorators.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix some unused imports and local variables.Ben Sturmfels2021-09-231-2/+2
|
* Remove remaining imports/calls to six not automatically removed by pyupgrade.Ben Sturmfels2021-03-051-1/+1
|
* Apply `pyupgrade --py3-plus` to remove Python 2 compatibility code.Ben Sturmfels2021-03-051-10/+10
|
* Fix #5513 - Can't delete blog post draftsayleph2017-08-151-2/+1
| | | | | | | | | | Modify the @get_media_entry_by_id decorator to return media regardless of processing state. Separately modify all view functions that use the @get_media_entry_by_id decorator to require that the media be in the processed state, other than for the media_confirm_delete view. This allows blog post drafts to be deleted without returning a 404. Further, it adds the ability to delete unprocessed media in the future, which would be a nice addition to the user processing panel.
* Fix #5433 - Typo in decoratorsAndrew Browning2016-03-011-1/+1
|
* Comment changes for federationJessica Tallon2015-10-201-6/+8
| | | | | | | | | | | | | | This adds a new Comment link table that is used to link between some object and then the comment object, which can be more or less any object in Mediagoblin. The MediaComment has been renamed to TextComment as that more aptly describes what it is. There is migrations for these changes. There is also the conslidation of the Report tables into a single Report table, the same with the Notification objects. This is because both of them split out MediaEntry and Comment versions into their own polymorphic versions from a base, this is no longer a meaningful distinction as comments can be anything.
* Fix #5353 - Bug in OAuth which referenced "user"Jessica Tallon2015-10-171-1/+1
| | | | | | | There was a recent change in 0f3bf8d where several names which were used to refer the actor where renamed to the standard "actor" property name. There were some places in the OAuth decorator and the OAuth views where the old names were still referred. This fixes that.
* Collection changes and migration for federationJessica Tallon2015-10-071-5/+5
| | | | | | | - Adds a "type" column to the Collection object and allows the CollectionItem model to contain any object. - Changes "items" to "num_items" as per TODO - Renames "uploader", "creator" and "user" to a common "actor" in most places
* Fix #1066 - OAuth Invalid signature errorJessica Tallon2015-08-201-1/+1
| | | | | | It seems that the GET params on a URL should be included when one signs the request. Mediagoblin was just using the base URL without them. This should fix that.
* Change codebase to query or create correct User modelJessica Tallon2015-07-311-8/+8
| | | | | | | The code base had many references to User.username and other specific to LocalUser attributes as that was the way it use to exist. This updates those to query on the generic User model but filtering by attributes on the LocalUser.
* Fix #1066 - Fix OAuth issue when using GET paramsJessica Tallon2014-12-181-1/+1
|
* Fix #1024 - Correctly set generator on ActivitiesJessica Tallon2014-12-021-3/+3
|
* Merge branch 'master' into merge-python3-portChristopher Allan Webber2014-09-161-7/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Has some issues, will iteratively fix! Conflicts: mediagoblin/gmg_commands/__init__.py mediagoblin/gmg_commands/deletemedia.py mediagoblin/gmg_commands/users.py mediagoblin/oauth/views.py mediagoblin/plugins/api/views.py mediagoblin/tests/test_api.py mediagoblin/tests/test_edit.py mediagoblin/tests/test_oauth1.py mediagoblin/tests/test_util.py mediagoblin/tools/mail.py mediagoblin/webfinger/views.py setup.py
| * Fix #923 - add allow_admin to user_has_privilege decoratorJessica Tallon2014-07-291-4/+8
| |
| * Add basic upload image capabilitiesxray72242014-07-221-1/+1
| |
| * Add basic comment support and flesh out some other endpointsJessica Tallon2014-07-221-1/+8
| |
| * Starts the user (profile) endpoint and lays groundwork for inbox and feed ↵Jessica Tallon2014-07-221-1/+1
| | | | | | | | endpoint
* | Use six.moves.urllib.parse instead of the urlparse module.Berker Peksag2014-05-261-1/+2
|/
* Weird indentation issue, fixing!Christopher Allan Webber2013-11-131-2/+3
| | | | This commit sponsored by Iain Nicol. Thank you!
* This commit was solely to remove unused imports in the code that I have writtentilly-Q2013-09-231-2/+1
|
* At this point, I am very close to done with this code! I made one big change attilly-Q2013-09-231-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | paroneayea's request, which was to make to possible to turn off user's ability to file reports through a mediagoblin.ini setting. Aside from this, I had to make it possible for the Moderation User Panel to display more than 10 users. And aside from that, I just had to fix some errors which cropped up with my most recent additions. I also fixed some tests that were broken because I had changed the checks for whether or not a user is active. Nearing the end! =============================================================================== Made it possible to turn off reports through a mediagoblin.ini setting =============================================================================== --\ mediagoblin.ini --\ mediagoblin/config_spec.ini --\ mediagoblin/decorators.py --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/user_pages/media.html --\ mediagoblin/user_pages/views.py =============================================================================== Made User Panel capable of showing more than 1 page of users =============================================================================== --\ mediagoblin/moderation/forms.py --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/moderation/user_panel.html =============================================================================== Fixed Broken Tests =============================================================================== --\ mediagoblin/tests/test_notifications.py --\ mediagoblin/tests/test_openid.py --\ mediagoblin/tests/test_persona.py --\ mediagoblin/tests/test_reporting.py =============================================================================== Fixed errors in code =============================================================================== --\ mediagoblin/db/migrations.py --| Set nullable to True for MediaReports' and CommentReports' content foreign |keys --\ mediagoblin/db/models.py --| Got rid of cascading rules for MediaReports' and CommentReports' content |foreign keys. This makes it possible for the Reports to continue to exist |after the content is deleted. --\ mediagoblin/moderation/tools.py --| Fixed formatting of Report Resolution Methods --| Took out pieces of code used in debugging --\ mediagoblin/templates/mediagoblin/base.html --\ mediagoblin/templates/mediagoblin/moderation/report.html --| Made reports details page able to tell what is a deleted archived report. --\ mediagoblin/templates/mediagoblin/moderation/report_panel.html --\ mediagoblin/templates/mediagoblin/utils/report.html
* I did some more code-keeping in this commit. I added a lot of documentation, sotilly-Q2013-09-031-42/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that most of my functions do indeed have effective docstrings. I also changed the decorators so that they imply eachother in a logical way. I also modified the one decorator get_media_comment_by_id to be more usable with the variable urls of mediagoblin.user_pages.views:file_a_report. I also noticed a few tests had broken, so I went through them and fixed them up, finding that mostly there were problems in my actual writing of the tests. I also did a few other small tasks such as creating a new User method to check whether or not a User is ban- -ned. =============================================================================== Added in documentation =============================================================================== --\ mediagoblin/db/models.py --\ mediagoblin/decorators.py --\ mediagoblin/moderation/forms.py --\ mediagoblin/moderation/tools.py --\ mediagoblin/moderation/views.py --\ mediagoblin/user_pages/lib.py =============================================================================== Rearranged decorators to be more efficient =============================================================================== --\ mediagoblin/decorators.py --| Made it so that user_not_banned is encapsulated in require_active_login --| Made it so that require_active_login is encapsulated in user_has_privilege --| Changed get_media_comment_by_id into get_optional_media_comment_by_id. It | now returns valid code if the MediaComment id is absent. This makes it pos- | -sible to use this decorator for the function: | mediagoblin.user_pages.views:file_a_report --\ mediagoblin/user_pages/views.py --| Replaced the mediagoblin.user_pages.views:file_a_comment_report with the | decorator mentioned above --\ mediagoblin/user_pages/routing.py ----------------------------------------------------------- | took out unnecessary @user_not_banned decorators | ----------------------------------------------------------- --\ mediagoblin/submit/views.py --\ mediagoblin/user_pages/views.py =============================================================================== Fixed broken tests =============================================================================== --\ mediagoblin/tests/test_auth.py --\ mediagoblin/tests/test_privileges.py --\ mediagoblin/tests/test_submission.py =============================================================================== Fixed broken code =============================================================================== --\ mediagoblin/tools/response.py =============================================================================== Other Tasks =============================================================================== --\ mediagoblin/db/models.py --| Added in User.is_banned() method --\ mediagoblin/decorators.py --| Utitilized User.is_banned() method in the user_not_banned decorator --\ mediagoblin/moderation/views.py --| Made it impossible for an admin to ban themself. --| Got rid of a vestigial print statement --\ mediagoblin/templates/mediagoblin/base.html --| Made it so the top panel does not show up for users that are banned. --\ mediagoblin/templates/mediagoblin/moderation/user.html --| Rearranged the javascript slightly ===============================================================================
* This was a big commit! I included lots of documentation below, but generally Itilly-Q2013-08-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | did a few things. I wrote many many many new tests, either in old test files or in the three new test files I made. I also did some code-keeping work, deleting trailing whitespace and deleting vestigial code. Lastly, I fixed the parts of the code which I realized were broken thru the process of running tests. =============================================================================== Deleted trailing whitespace: =============================================================================== --\ mediagoblin/decorators.py --\ mediagoblin/auth/tools.py --\ mediagoblin/db/migrations.py --\ mediagoblin/db/models.py --\ mediagoblin/gmg_commands/users.py --\ mediagoblin/moderation/forms.py --\ mediagoblin/moderation/tools.py --\ mediagoblin/moderation/views.py --\ mediagoblin/templates/mediagoblin/moderation/media_panel.html --\ mediagoblin/templates/mediagoblin/moderation/report.html --\ mediagoblin/templates/mediagoblin/moderation/report_panel.html --\ mediagoblin/templates/mediagoblin/moderation/user.html --\ mediagoblin/templates/mediagoblin/moderation/user_panel.html --\ mediagoblin/templates/mediagoblin/user_pages/report.html --\ mediagoblin/templates/mediagoblin/utils/report.html --\ mediagoblin/user_pages/lib.py --\ mediagoblin/user_pages/views.py =============================================================================== Deleted Vestigial Code =============================================================================== --\ mediagoblin/db/util.py --\ mediagoblin/tests/test_notifications.py =============================================================================== Modified the Code: =============================================================================== --\ mediagoblin/moderation/tools.py --| Encapsulated the code around giving/taking away privileges into two | funtions. --\ mediagoblin/moderation/views.py --| Imported and used the give/take away privilege functions --| Replaced 'require_admin_or_moderator_login' with |'user_has_privilege(u"admin")' for adding/taking away privileges, only | admins are allowed to do this. --\ mediagoblin/templates/mediagoblin/banned.html --| Added relevant translation tags --| Added ability to display indefinite banning --\ mediagoblin/templates/mediagoblin/user_pages/media.html --| Made sure the add comments button was only visible for users with the | `commenter` privilege --\ mediagoblin/tests/test_submission.py --| Paroneayea fixed a DetachedInstanceError I was having with the our_user | function --\ mediagoblin/tests/tools.py --| Added a fixture_add_comment_report function for testing. --\ mediagoblin/tools/response.py --| Fixed a minor error where a necessary return statement was missing --| Fit the code within 80 columns --\ mediagoblin/user_pages/views.py --| Added a necessary decorator to ensure that only users with the 'commenter' | privilege can post comments =============================================================================== Wrote new tests for an old test file: =============================================================================== --\ mediagoblin/tests/test_auth.py --| Added a new test to make sure privilege granting on registration happens | correctly --\ mediagoblin/tests/test_modelmethods.py* --| Added a test to ensure the User method has_privilege works properly =============================================================================== Wrote entirely new files full of tests: =============================================================================== --\ mediagoblin/tests/test_moderation.py --\ mediagoblin/tests/test_privileges.py --\ mediagoblin/tests/test_reporting.py =============================================================================== =============================================================================== NOTE: Any files I've marked with a * in this commit report, were actually subm- itted in my last commit. I made that committ to fix an error I was having, so they weren't properly documented in that report. =============================================================================== ===============================================================================
* Merge branch 'master' into OPW-Moderation-Updatetilly-Q2013-08-201-10/+48
|\ | | | | | | | | | | | | | | Conflicts: mediagoblin/db/models.py mediagoblin/decorators.py mediagoblin/routing.py mediagoblin/user_pages/views.py
| * Fixes problem with headers pointing to old federation dirxray72242013-07-291-2/+2
| |
| * Merge branch 'master' of git://gitorious.org/mediagoblin/mediagoblinxray72242013-07-141-11/+11
| |\
| * | Ensures endpoint queries with @oauth_required are validatedxray72242013-07-111-2/+4
| | |
| * | Adds the decoratorxray72242013-07-111-3/+17
| | |
| * | Cleans up some of the OAuth codexray72242013-07-111-1/+3
| | |
| * | Finishes most of oauth, just decorator to completexray72242013-07-111-1/+15
| | |
* | | This has been an update to clean out the code a little bit. The primary changetilly-Q2013-08-131-15/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | This commit was the work I did fixing errors that cropped up from the merge.tilly-Q2013-07-311-5/+7
| | | | | | | | | | | | | | | There were a few errors because of the switch from sqlalchemy 0.7 to 0.8 but I cleared them up.
* | | Merge branch 'ticket-679' into OPW-Moderation-Updatetilly-Q2013-07-291-16/+44
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/auth/tools.py mediagoblin/auth/views.py mediagoblin/db/migration_tools.py mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/decorators.py mediagoblin/user_pages/views.py
| * | Patch by Strum. Ticket #451 - Convert all mongokit style .find, .find_one, ↵Rodney Ewing2013-07-111-11/+11
| |/ | | | | | | .one calls over to SQLAlchemy queries
| * merge --squash openid branch to take care of a false merge commit in theRodney Ewing2013-07-031-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | basic_auth branch that openid is forked from Commits squashed together (in reverse chronological order): - do the label thing only for boolean fields - made edit_account to autofocus on the first field - added feature to render_divs where if field.label == '' then it will render form.description the same a render_label - added allow_registration check - refactored create_user - removed verification_key from create_user - removed get_user from openid - cleanup after removing openid from template_env.globals - fix for werkzueg 0.9.1 - cleanup after merge - more tests - restored openid extra_validation just for safety - tests for openid - deleted openid extra_validation - passed next parameter in session for openid - fixed a bug that was deleting the messages - implemented openid store using sqlalchemy - ask openid provider for 'nickname' to prefill username in registration form - refactored delete openid url to work with generic urls such as google and to not allow a user to delete a url if it is there only one and they don't have a pw - refactored login to register user workflow, which fixed a problem where the 'or register with a password link' wasn't showing up when the finish_login view called the register view because there wasn't any redirect. - added the ability to remove openid's - added the ability to add openids to an existing account - refactored start_login and finish_login views - modified edit_account.html to use render_divs - modified gmg/edit/views to behave appropriatly if no password authentication is enabled. moved the update email stuff to it's own funtion to make edit_account view cleaner. edit_account now modifies the form depending on the plugins. - minor typos - added retrieving email from openid provider - moved allow_registration check to a decorator - moved check if auth is enabled to a decorator - changed openid user registration to go through login first - cleanup after merge - modified verification emails to use itsdangerous tokens - added error handling on bad token, fixed route, and added tests - added support for user to change email address - added link to login view openid/password in login template - updated openid get_user function - modified get_user function to take kwargs instead of username - no need for user might be email kwarg in check_login_simple - added gen_password_hash and check_password functions to auth/__init__ - added focus to form input - made imports fully qualified - modified basic_auth.check_login to check that the user has a pw_hash first - changed occurances of form.data['whatever'] to form.whatever.data - convert tabs to spaces in register template, remove unsed templates, and fixed trans tags in templates - in process of openid login. it works, but needs major imporvements - make password field required in basic_auth form - check if password field present in basic_auth create_user - modified openid create_user function - modified models based on Elronds suggestions - changed register form action to a variable to be passed in by the view using the template - openid plugin v0, still need to authenticate via openid. - added a register_user function to be able to use in a plugin's register view, and modified auth/views.register to redirect to openid/register if appropriate. - Modified basic_auth plugin to work with modified auth plugin hooks. Added context variables. Removed basic_auth/tools which was previously renamed to basic_auth/lib. - modified auth/__init__ hooks to work better with multiple plugins. Removed auth/lib.py. And added a basic_extra_verification function that all plugins will use. - added models and migrations for openid plugin
* | Whew. This is a big update. I did some significant keeping work. I moved all oftilly-Q2013-07-171-6/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | This update I mostly did work on the templates for the admin pages. I did a co-tilly-Q2013-07-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -uple other small changes. I changed the information around the media processi- ng panel to be more specific, since it was written when it was the only admin page. Git didn't catch this, but I renamed the templates, so mediagoblin/templ- ates/admin/user.html now referrs to the page which shows the details of a spec- ific user. The list view pages are now named ELEMENT_panel.html(ie. user_panel) I also added a column reported_user_id to the ReportBase table, and had to add to Report filing to make sure that column gets created. Also I moved the report media button (on a media page) to the sidebar, though it still needs some form- atting --\ mediagoblin/static/images/icon_clipboard.png --| Added this image for use in template mediagoblin/admin/report.html. --| Distributed by the GNOME project http://www.gnome.org --| Under a GNU LGPL v.3 or Creative Commons BY-SA 3.0 license. --| I'm still trying to figure out the appropriate way to attribute this in | the code --\ mediagoblin/templates/mediagoblin/admin/media_panel.html --| This template is actually the template formerly know as media.html. I | renamed it for clarity --\ mediagoblin/templates/mediagoblin/admin/report_panel.html --| This template is actually the template formerly know as report.html. I | renamed it for clarity --\ mediagoblin/templates/mediagoblin/admin/user_panel.html --| This template is actually the template formerly know as user.html. I renam- | -ed it for clarity --\ mediagoblin/templates/mediagoblin/utils/report.html --| This template is included in the media_home page. It is the report media | button. I figured I'd write it like this in case it got more complicated. --\ mediagoblin/admin/routing.py --| I changed the routing path /a/panel to /a/media for specificity --\ mediagoblin/admin/views.py --| I renamed admin_processing_panel to admin_media_processing_panel --| I wrote a new view function admin_reports_detail --| I wrote a new view function admin_users_detail --\ mediagoblin/db/migrations.py --| I added in the column reported_user_id to the ReportBase_v0 class --\ mediagoblin/db/models.py --| I added in the column reported_user_id to the ReportBase class --\ mediagoblin/static/css/base.css --| I added in css classes to display a report. Right now, they are just echo- | -ing the ways comments are displayed, but with the link in another color --\ mediagoblin/templates/mediagoblin/admin/report.html --| Created this new template (although git doesn't realize it) to show the de- | -tails of a specific report, indicated in the URL --\ mediagoblin/templates/mediagoblin/admin/user.html --| Created this new template (although git doesn't realize it) to show the de- | -tails of a specific user, indicated in the URL --\ mediagoblin/templates/mediagoblin/base.html --| Redirected the link from /a/panel to /a/media --\ mediagoblin/templates/mediagoblin/user_pages/media.html --| Moved the media report button to the sidebar --\ mediagoblin/user_pages/lib.py --| Changed the creation of reports, so that they also assign a column for rep- | -orted_user_id.
* | This was a simple commit. I changed all references to Groups into Privileges sotilly-Q2013-07-031-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | In this commit, I have made a few changes and tightened up some of my modelstilly-Q2013-06-271-1/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | code. I added in two major pieces of functionality: table foundations and a decorator to confirm whether or not a user is a member of a certain group. Table Foundations are default rows that should be present in a given table as soon as the database is initialized. For example, I am using these to populate the core__groups table with all of the necessary groups ('moderator', 'com- menter', etc). Right now, this is achieved by adding a dictionary of parameters (with the parameters as lists) to the constant FOUNDATIONS in mediagoblin.db.models. The keys to this dictionary are uninstantiated classes. The classes which require foundations also have must have a constructor so that the list of parameters can be passed appropriately like so: Model(*parameters) In order to implement these foundations, I added the method populate_table_fou- -ndations to MigrationManager in mediagoblin.db.migration_tools. The decorator, called user_in_group, accepts as a parameter a unicode string, and then decides whether to redirect to 403 or let the user access the page. The identifier is the Group.group_name string, because I believe that will allow for the most readable code. I also added in the simple decorator require_admin_login. In terms of tightening up my code, I made many minor changes to my use of white space and made a few small documentation additions. I removed a vestigial class (ReportForm) from mediagoblin.user_pages.forms. I moved all of my migrations in- to one registered Migration. Setting up Foundations ============================== --\ mediagoblin/db/migration_tools.py --| created: MigrationManager.populate_table_foundations --| modified: MigrationManager.init_or_migrate to run | self.populate_table_foundations on init --\ mediagoblin/db/models.py --| created: FOUNDATIONS ----| created: group_foundations Working With Permissions ============================== --\ mediagoblin/decorators.py --| created: user_in_group --| created: require_admin_login --\ mediagoblin/user_pages/views.py --| modified: added decorator user_in_group to file_a_report --\ mediagoblin/admin/views.py --| modified: added decorator require_admin_login to all views functions General Code Tidying ============================= --/ mediagoblin/admin/views.py --/ mediagoblin/user_pages/forms.py --/ mediagoblin/db/models.py --/ mediagoblin/user_pages/lib.py --/ mediagoblin/user_pages/views.py --/ mediagoblin/db/migrations.py
* | This is the first stage of my project of implenting admin/moderator functiona-tilly-Q2013-06-241-1/+19
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lity. At this point, I have finished all the of basic work with the models! I still need to do some tightening of their documentation, but they seem to be working well. Working with Models ======================================== --\ mediagoblin/db/models.py --| Added in the Report model and table. This model is strictly a parent ----| Added in the CommentReport model which holds information about a report | filed against a comment. This class inherits from Report. ----| Added in the MediaReport model which holds information about a report f- | -iled against a media entry. This class inherits from Report. --| Added in a UserBan model and table. This model is in a one to one relatio- | -nship with User. This object acts as a marker for whether a user is banned | or not. --| Added in a Group model. These objects are in a many-to-many relationship | with User to explain which privileges a User has. ----| Added in GroupUserAssociation which is a table used to hold this many to | many relationship between Group & User. --\ mediagoblin/db/migrations.py --| Added in the migrations for all of the additions to models --| Added UserBan_v0 --| Added Report_v0 ----| Added CommentReport_v0 ----| Added MediaReport_v0 --| Added Group_v0 ----| Added GroupUserAssociation_v0 Working with Templates, Views, and Routing =============================================== >>> Reporting a Comment or a MediaEntry --\ mediagoblin/user_pages/views.py --| Added in the function file_a_report to allow user to file reports against | MediaEntries or Comments. Handles GET and POST requests. --| Added in the function file_a_comment_report which uses file_a_report but | also catches appropriate information for comment_ids. I may be able to do | this more eloquently with decorators. --\ mediagoblin/user_pages/routing.py --| Added in route 'mediagoblin.user_pages.media_home.report_media' | (linked to address /u/<user>/m/<media>/report/ ) --| Added in route ''mediagoblin.user_pages.media_home.report_comment' | (linked to address /u/<user>/m/<media>/c/<comment>/report/ ) --\ mediagoblin/templates/mediagoblin/user_pages/report.html --| I created this file to handle the filing of a report. --\ mediagoblin/templates/mediagoblin/user_pages/media.html --| Modified this file to add in links allowing users to report either media | or comments. --\ mediagoblin/user_pages/lib.py --| Added in build_report_form which processes data as either a CommentReport or | a MediaReport depending on which parameters are present --\ mediagoblin/user_pages/forms.py --| Added in CommentReportForm --| Added in MediaReportForm --| note: ReportForm is vestigial to an earlier strategy I used and I'll remove it | promptly --\ mediagoblin/decorators.py --| Added in 'get_media_comment_by_id' for use in mediagoblin/user_pages/views.py >>> New Admin Panels --\ mediagoblin/admin/views.py --| Added in the function admin_users_panel --| Added in the function admin_reports_panel --\ mediagoblin/admin/routing.py --| Added in route 'mediagoblin.admin.users' | (linked to address '/a/users') --| Added in route 'mediagoblin.admin.reports' | (linked to address '/a/reports/') --\ mediagoblin/templates/admin/user.html --| Created this file as a template for monitoring users --\ mediagoblin/templates/admin/report.html --| Created this file as a template for monitoring reports filed against media or | comments
* Do not encode the next kwarg twiceJoar Wandborg2013-03-021-1/+1
|
* Simplifying the "id:" url detection, per Elrond's suggestion.Christopher Allan Webber2013-02-261-11/+9
| | | | | | As pointed out, we didn't need that nested if. This commit sponsored by Paul Kuriakose. Thank you!
* Replacing several request.matchdict['media'] -> media_slug ... shorter!Christopher Allan Webber2013-02-261-2/+2
| | | | | | Thanks for pointing this out, Elrond ;) This commit sponsored by Gerardo Joven Valdivia. Thank you!
* Media URLs with ids in them are now like /u/cwebber/m/id:4112/ rather than ↵Christopher Allan Webber2013-02-261-16/+23
| | | | | | | | /u/cwebber/m/4112/ This avoids some potential name collision issues. This commit sponsored by Asokan Pichai. Thank you!
* Small PEP-8 compliance fix.Christopher Allan Webber2013-02-261-3/+3
| | | | This commit sponsored by Mats Sjöberg. Thanks!
* removed unnecessary collection lookupAndrás Veres-Szentkirályi2013-02-221-4/+0
|
* user.get('moo') -> user.mooSebastian Spaeth2013-01-221-2/+2
| | | | | | | User fields are always existent, so there is no need to .get() them, just use them directly. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Shorten Workbench(Manager) method namesSebastian Spaeth2013-01-161-1/+1
| | | | | | | | | | | 1) destroy_self() is a horrible function name, make it "destroy". workbench.destroy() is descriptive enough. 2) WorkbenchManager.create_workbench() -> WorkbenchManager.create() We use the pattern "with workbench_manager.create() as workbench:" No need to mention workbenches three times in a row... Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Implement @get_workbench decoratorSebastian Spaeth2013-01-161-0/+12
| | | | | | | | This passes in a Workbench() via the 'workbench' keyword argument, and conveniently cleans it up after the function has finished. 2 out of our 5 backends forgot to clean up their workbench, so this is clearly needed :-). Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Start to use the media_id in "admin" URLs.Elrond2013-01-111-2/+6
| | | | | | | | | | | | We have a bunch of URLs that are more for internal use. At least they're definitely not intended to be posted somewhere for long term useage. When those things affect a media, it's much better to reference the media by its id. This can't change, ever. This is better for races. Like someone posting a comment while the owner corrects a typo in the slug.