1
0

21292448a775_update_acls_descriptions.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. """Update ACLs descriptions
  2. Revision ID: 21292448a775
  3. Revises: 3237fc64b306
  4. Create Date: 2017-10-12 16:55:05.066340
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '21292448a775'
  8. down_revision = '3237fc64b306'
  9. from alembic import op
  10. import sqlalchemy as sa
  11. ACLS = {
  12. 'create_project': 'Create a new project',
  13. 'fork_project': 'Fork a project',
  14. 'issue_assign': 'Assign issue to someone',
  15. 'issue_create': 'Create a new ticket',
  16. 'issue_change_status': 'Change the status of a ticket',
  17. 'issue_comment': 'Comment on a ticket',
  18. 'pull_request_close': 'Close a pull-request',
  19. 'pull_request_comment': 'Comment on a pull-request',
  20. 'pull_request_flag': 'Flag a pull-request',
  21. 'pull_request_merge': 'Merge a pull-request',
  22. 'issue_subscribe': 'Subscribe the user with this token to an issue',
  23. 'issue_update': 'Update an issue, status, comments, custom fields...',
  24. 'issue_update_custom_fields': 'Update the custom fields of an issue',
  25. 'issue_update_milestone': 'Update the milestone of an issue',
  26. 'modify_project': 'Modify an existing project',
  27. 'generate_acls_project': 'Generate the Gitolite ACLs on a project'
  28. }
  29. def upgrade():
  30. """ Update the ACLs description stored in the database to be more
  31. generic.
  32. """
  33. for acl in ACLS:
  34. op.execute(
  35. "UPDATE acls SET description='%s' WHERE name='%s';" % (
  36. ACLS[acl], acl)
  37. )
  38. def downgrade():
  39. """ There isn't really anything to back out, so just keep going. """
  40. pass