aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/migrations.py
diff options
context:
space:
mode:
authortilly-Q <nattilypigeonfowl@gmail.com>2013-07-03 14:46:21 -0400
committertilly-Q <nattilypigeonfowl@gmail.com>2013-07-03 14:46:21 -0400
commit3fb96fc97800ae032e599006e3f49ffd69926c88 (patch)
tree93c19ff89864f065cb8fea5a313d76a1f8c09c0b /mediagoblin/db/migrations.py
parent9b8ef022ef874304fb3d5aead612ec3b8fb23e9a (diff)
downloadmediagoblin-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/db/migrations.py')
-rw-r--r--mediagoblin/db/migrations.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py
index 5e9a71d4..053f3db2 100644
--- a/mediagoblin/db/migrations.py
+++ b/mediagoblin/db/migrations.py
@@ -26,7 +26,7 @@ from sqlalchemy.sql import and_
from migrate.changeset.constraint import UniqueConstraint
from mediagoblin.db.migration_tools import RegisterMigration, inspect_table
-from mediagoblin.db.models import MediaEntry, Collection, User, MediaComment, Group
+from mediagoblin.db.models import MediaEntry, Collection, User, MediaComment, Privilege
MIGRATIONS = {}
@@ -329,23 +329,23 @@ class UserBan_v0(declarative_base()):
expiration_date = Column(DateTime)
reason = Column(UnicodeText, nullable=False)
-class Group_v0(declarative_base()):
- __tablename__ = 'core__groups'
+class Privilege_v0(declarative_base()):
+ __tablename__ = 'core__privileges'
id = Column(Integer, nullable=False, primary_key=True, unique=True)
- group_name = Column(Unicode, nullable=False)
+ privilege_name = Column(Unicode, nullable=False)
-class GroupUserAssociation_v0(declarative_base()):
- __tablename__ = 'core__group_user_associations'
+class PrivilegeUserAssociation_v0(declarative_base()):
+ __tablename__ = 'core__privileges_users'
group_id = Column(
- 'core__group_id',
+ 'core__privilege_id',
Integer,
ForeignKey(User.id),
primary_key=True)
user_id = Column(
'core__user_id',
Integer,
- ForeignKey(Group.id),
+ ForeignKey(Privilege.id),
primary_key=True)
@RegisterMigration(11, MIGRATIONS)
@@ -354,8 +354,8 @@ def create_moderation_tables(db):
CommentReport_v0.__table__.create(db.bind)
MediaReport_v0.__table__.create(db.bind)
UserBan_v0.__table__.create(db.bind)
- Group_v0.__table__.create(db.bind)
- GroupUserAssociation_v0.__table__.create(db.bind)
+ Privilege_v0.__table__.create(db.bind)
+ PrivilegeUserAssociation_v0.__table__.create(db.bind)
db.commit()