aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/migrations.py
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | This was a simple commit. I changed all references to Groups into Privileges sotilly-Q2013-07-031-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | not all JSONEncoded fields should be mutable dictsRodney Ewing2013-09-191-2/+2
| | | | |
* | | | | make all JSONEncoded columns mutableRodney Ewing2013-09-191-2/+2
| | | | |
* | | | | need to use mutation tracking to detect changes in JSONEncoded typesRodney Ewing2013-09-191-2/+2
| | | | |
* | | | | Merge remote-tracking branch 'refs/remotes/rodney757/reprocessing'Christopher Allan Webber2013-09-181-0/+12
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/db/migrations.py
| * | | | | get and set metadata for a MediaFileRodney Ewing2013-08-211-2/+13
| | |_|/ / | |/| | |
* | | | | Merge remote-tracking branch 'refs/remotes/rodney757/file_limits'Christopher Allan Webber2013-09-181-0/+20
|\ \ \ \ \ | |_|_|_|/ |/| | | | | | | | | | | | | | Conflicts: mediagoblin/db/migrations.py
| * | | | added user upload limitsRodney Ewing2013-08-261-2/+22
| |/ / /
* | | | Not sure why there wasn't a .commit() at the end of ↵Christopher Allan Webber2013-08-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add_new_notification_tables() ... but it seems like there should be and it wouldn't hurt. This commit sponsored by Julio Claudio Matus Ramirez. Thank you!
* | | | add user prefrence for insite notificationsRodney Ewing2013-08-201-2/+14
|/ / /
* | | Fix problem with migration - OAuthJessica Tallon2013-07-221-6/+8
| | |
* | | Moves first versions of the the models to migrationsxray72242013-07-181-7/+72
| | |
* | | Adds migration for OAuth1 tablesxray72242013-07-181-1/+15
| |/ |/|
* | merge --squash openid branch to take care of a false merge commit in theRodney Ewing2013-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Explain about sqlite dropping the constraint and why we're adding it back ↵Christopher Allan Webber2013-06-251-0/+2
| | | | | | | | manually.
* | Merge remote-tracking branch 'upstream/master' into authRodney Ewing2013-06-251-2/+77
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mediagoblin/app.py mediagoblin/auth/forms.py mediagoblin/auth/tools.py mediagoblin/db/migrations.py mediagoblin/db/models.py mediagoblin/edit/views.py mediagoblin/plugins/basic_auth/tools.py mediagoblin/tests/test_edit.py
| * \ Merge remote-tracking branch 'refs/remotes/joar/notifications'Christopher Allan Webber2013-06-221-2/+56
| |\ \ | | | | | | | | | | | | | | | | Conflicts: mediagoblin/db/migrations.py
| | * | New notificationsJoar Wandborg2013-06-091-1/+56
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added request.notifications - Email configuration fixes - Set config_spec default SMTP port to `0` and switch to SSL/non-SSL default if `port == 0` - Added email_smtp_use_ssl configuration setting - Added migrations for notification tables - Added __repr__ to MediaComment(Mixin) - Added MediaComment.get_entry => MediaEntry - Added CommentSubscription, CommentNotification, Notification, ProcessingNotification tables - Added notifications.task to celery init - Fixed a bug in the video transcoder where pygst would hijack the --help argument. - Added notifications - views - silence - subscribe - routes - utility methods - celery task - Added half-hearted .active comment CSS style - Added quick JS to show header_dropdown - Added fragment template to show notifications in header_dropdown - Added fragment template to show subscribe/unsubscribe buttons on media/comment pages - Updated celery setup tests with notifications.task - Tried to fix test_misc tests that I broke - Added notification tests - Added and extended tests.tools fixtures - Integrated new notifications into media_home, media_post_comment views - Bumped SQLAlchemy dependency to >= 0.8.0 since we need polymorphic for the notifications to work
| * / modified verification emails to use itsdangerous tokensRodney Ewing2013-05-291-0/+20
| |/
* | typoRodney Ewing2013-06-251-1/+1
| |
* | changes after cwebb's reviewRodney Ewing2013-06-211-0/+4
| |
* | changed User model pw_hash field to nullable and added migrationsRodney Ewing2013-05-241-0/+11
|/
* Make uuid look like a uuid.Elrond2013-04-271-1/+1
| | | | | | If we really have to create a visible uuid (for a slug in this case), don't try to hide the fact that it is a uuid. So format it like a uuid.
* Check for duplicate collection slugs and make them unique. Add unique ↵Rodney Ewing2013-04-241-1/+37
| | | | constraint to collection.slug model
* Simplifying the test for whether or not a user and slug combo exists.Christopher Allan Webber2013-02-271-3/+1
| | | | | | | Thanks to tchernobog for catching this (it was breaking on postgres) and Elrond for the suggestion on how to fix it. This commit sponsored by Caleb Cooper. Thanks Caleb!
* Import sqlalchemy's and_ and use it in our select statementChristopher Allan Webber2013-02-261-2/+3
| | | | This commit sponsored by Hans-Jörg Dollansky. Thank you!
* And of course, we need to actually commit at the end of a migration.Christopher Allan Webber2013-02-261-0/+3
| | | | This commit sponsored by Tamas Kemenczy. Thanks, Tamas!
* Dope'ily missed .count() on the query where we're countingChristopher Allan Webber2013-02-251-1/+1
| | | | | | Thanks for catching, Elrond. This commit sponsored by Graham King. Thank you!
* Supplying migrations for a bold new era of mediagoblin entry slugsChristopher Allan Webber2013-02-251-0/+54
| | | | | | | | | | | | | | | | Okay, that's a totally confusing statement, but the docstring of this migration summarizes it well: Entries without slugs now display differently in the url like: /u/cwebber/m/id=251/ ... because of this, we should back-convert: - entries without slugs should be converted to use the id, if possible, to make old urls still work - slugs with = (or also : which is now also not allowed) to have those stripped out (small possibility of breakage here sadly) This commit sponsored by John Sullivan. Thanks johnsu01! :)
* Use inspect_table; default user license==None.Elrond2013-01-221-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Use inspect_table in the new migration. Makes code more readable, really. And make the default for the preferred license be None. This is a userspace thing, so we can even change the migration here. Changing the migration means, that people running the migration before this commit get a "" in User.license_preference, while people running the migration now get a None. Both values are okay. None has been designated as "Use the site's default". We're not actually having a site default right now. Which means no license is selected in the dropdown. While "" means "All rights reserved" being chosen by the user. Side note: Having no license being selected in the submit dropdown is as "worse" as before and does not really hurt much. MediaEntry.license==None means "All rights reserved" as does "" also do.
* Add a license preference fieldMark Holmquist2013-01-171-0/+12
| | | | | | | | | | | | | This feature is absolutely necessary. Now a user can simply define their default license and quickly go through a form, as opposed to stopping to click on the select and choosing the same option over and over again. Also added DB migration for the field, so that's working now, too. Rebased by Sebastian and made the default value to be unicode. Reviewed-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
* Move db.sql.migration_tools to db.migration_tools.Elrond2013-01-081-1/+1
| | | | Follow the new trend.
* Add inspect_table.Elrond2013-01-081-7/+4
| | | | | | In our current scheme of migrations, we reflect the current sql schema into an SQLAlchemy schema. So let's have a tool function for this.
* Move all the migration tools into new migration_tools.pyElrond2013-01-081-1/+1
| | | | | | | | | Factor all the migration related stuff out into a new .db.sql.migration_tools. First we don't have to load this module for our normal server. Second it makes all the import dependencies a little more cleaner.
* Move db.sql.models* to db.models*Sebastian Spaeth2013-01-071-1/+1
|
* Move db.sql.util to db.utilSebastian Spaeth2013-01-071-1/+1
| | | | | | | | Now that sqlalchemy is providing the database abstractions, there is no need to hide everything in db.sql. sub-modules. It complicates the code and provides a futher layer of indirection. Move the db.sql.util.py to db.util.py and adapt the importers.
* Move db.sql.migrations to db.migrationsSebastian Spaeth2012-12-251-0/+189
|
* Move db/migrations.py -> db/mongo/migrations.pyElrond2011-12-201-110/+0
| | | | And change references.
* Move db/util.py -> db/mongo/util.pyElrond2011-12-201-1/+1
| | | | | - Change some reference - Provide a wrapper db/util.py
* Merge branch 'video_gstreamer-only'Joar Wandborg2011-11-211-0/+8
|\ | | | | | | | | | | Conflicts: mediagoblin/db/migrations.py mediagoblin/submit/views.py
| * Multimedia support - Commiting from a not yet finished state - Details belowJoar Wandborg2011-09-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | * DONE Initially testing with arista ** DONE Video display templates *** TODO Multi-browser support ** TODO Video thumbnails ** TODO Link to original video ** TODO Video cropping Also contains a lot of "debug" print's
* | Factor out a add_table_field functionElrond2011-10-211-23/+16
| | | | | | | | | | | | Migrations often just add a new field to some table/collection. So just have a nice helper function for this!
* | Finished splitting util.py into separate files.Aaron Williamson2011-10-011-1/+1
|/
* Merge branch 'gullydwarf-cfdv-f357_lost_password_functionality'Christopher Allan Webber2011-09-081-0/+15
|\ | | | | | | | | Conflicts: mediagoblin/auth/routing.py
| * user_add_forgot_password_token_and_expires migration should set new fields ↵Christopher Allan Webber2011-09-071-2/+2
| | | | | | | | to None/null
| * oops, uses Alejandro's fp_verification_key. my bad.Caleb Forbes Davis V2011-08-281-2/+2
| |
| * Adding fotgot password functionalityAlejandro Villanueva2011-08-281-0/+15
| |
* | 508. Updates copyright/license informationWill Kahn-Greene2011-09-011-1/+1
|/