Show More
@@ -195,13 +195,16 b' class PullrequestsController(BaseRepoCon' | |||||
195 | pull_request = PullRequest.get_or_404(pull_request_id) |
|
195 | pull_request = PullRequest.get_or_404(pull_request_id) | |
196 | if pull_request.is_closed(): |
|
196 | if pull_request.is_closed(): | |
197 | raise HTTPForbidden() |
|
197 | raise HTTPForbidden() | |
198 |
|
198 | #only owner or admin can update it | ||
199 | reviewers_ids = map(int, filter(lambda v: v not in [None, ''], |
|
199 | owner = pull_request.author.user_id == c.rhodecode_user.user_id | |
200 | request.POST.get('reviewers_ids', '').split(','))) |
|
200 | if h.HasPermissionAny('hg.admin', 'repository.admin')() or owner: | |
|
201 | reviewers_ids = map(int, filter(lambda v: v not in [None, ''], | |||
|
202 | request.POST.get('reviewers_ids', '').split(','))) | |||
201 |
|
203 | |||
202 | PullRequestModel().update_reviewers(pull_request_id, reviewers_ids) |
|
204 | PullRequestModel().update_reviewers(pull_request_id, reviewers_ids) | |
203 | Session.commit() |
|
205 | Session.commit() | |
204 | return True |
|
206 | return True | |
|
207 | raise HTTPForbidden() | |||
205 |
|
208 | |||
206 | @NotAnonymous() |
|
209 | @NotAnonymous() | |
207 | @jsonify |
|
210 | @jsonify | |
@@ -214,8 +217,7 b' class PullrequestsController(BaseRepoCon' | |||||
214 | h.flash(_('Successfully deleted pull request'), |
|
217 | h.flash(_('Successfully deleted pull request'), | |
215 | category='success') |
|
218 | category='success') | |
216 | return redirect(url('admin_settings_my_account')) |
|
219 | return redirect(url('admin_settings_my_account')) | |
217 | else: |
|
220 | raise HTTPForbidden() | |
218 | raise HTTPForbidden() |
|
|||
219 |
|
221 | |||
220 | def _load_compare_data(self, pull_request, enable_comments=True): |
|
222 | def _load_compare_data(self, pull_request, enable_comments=True): | |
221 | """ |
|
223 | """ |
@@ -68,17 +68,7 b' def upgrade(migrate_engine):' | |||||
68 | col.alter(index=Index('u_email_idx', 'email')) |
|
68 | col.alter(index=Index('u_email_idx', 'email')) | |
69 | col.alter(name="firstname", table=tbl) |
|
69 | col.alter(name="firstname", table=tbl) | |
70 |
|
70 | |||
71 | inherit_default_permissions = Column("users_group_inherit_default_permission", |
|
71 | # add inherit_default_permission column | |
72 | Boolean(), nullable=True, unique=None, |
|
|||
73 | default=True) |
|
|||
74 | inherit_default_permissions.create(table=tbl) |
|
|||
75 | inherit_default_permissions.alter(nullable=False, default=True, table=tbl) |
|
|||
76 |
|
||||
77 | #========================================================================== |
|
|||
78 | # GROUPS TABLE |
|
|||
79 | #========================================================================== |
|
|||
80 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import RepoGroup |
|
|||
81 | tbl = RepoGroup.__table__ |
|
|||
82 | inherit_default_permissions = Column("inherit_default_permissions", |
|
72 | inherit_default_permissions = Column("inherit_default_permissions", | |
83 | Boolean(), nullable=True, unique=None, |
|
73 | Boolean(), nullable=True, unique=None, | |
84 | default=True) |
|
74 | default=True) | |
@@ -86,20 +76,36 b' def upgrade(migrate_engine):' | |||||
86 | inherit_default_permissions.alter(nullable=False, default=True, table=tbl) |
|
76 | inherit_default_permissions.alter(nullable=False, default=True, table=tbl) | |
87 |
|
77 | |||
88 | #========================================================================== |
|
78 | #========================================================================== | |
|
79 | # USERS GROUP TABLE | |||
|
80 | #========================================================================== | |||
|
81 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import UsersGroup | |||
|
82 | tbl = UsersGroup.__table__ | |||
|
83 | # add inherit_default_permission column | |||
|
84 | gr_inherit_default_permissions = Column( | |||
|
85 | "users_group_inherit_default_permissions", | |||
|
86 | Boolean(), nullable=True, unique=None, | |||
|
87 | default=True) | |||
|
88 | gr_inherit_default_permissions.create(table=tbl) | |||
|
89 | gr_inherit_default_permissions.alter(nullable=False, default=True, table=tbl) | |||
|
90 | ||||
|
91 | #========================================================================== | |||
89 | # REPOSITORIES |
|
92 | # REPOSITORIES | |
90 | #========================================================================== |
|
93 | #========================================================================== | |
91 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import Repository |
|
94 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import Repository | |
92 | tbl = Repository.__table__ |
|
95 | tbl = Repository.__table__ | |
93 |
|
96 | |||
|
97 | # add enable locking column | |||
94 | enable_locking = Column("enable_locking", Boolean(), nullable=True, |
|
98 | enable_locking = Column("enable_locking", Boolean(), nullable=True, | |
95 | unique=None, default=False) |
|
99 | unique=None, default=False) | |
96 | enable_locking.create(table=tbl) |
|
100 | enable_locking.create(table=tbl) | |
97 | enable_locking.alter(nullable=False, default=False, table=tbl) |
|
101 | enable_locking.alter(nullable=False, default=False, table=tbl) | |
98 |
|
102 | |||
|
103 | # add locked column | |||
99 | _locked = Column("locked", String(255), nullable=True, unique=False, |
|
104 | _locked = Column("locked", String(255), nullable=True, unique=False, | |
100 | default=None) |
|
105 | default=None) | |
101 | _locked.create(table=tbl) |
|
106 | _locked.create(table=tbl) | |
102 |
|
107 | |||
|
108 | #add langing revision column | |||
103 | landing_rev = Column("landing_revision", String(255), nullable=True, |
|
109 | landing_rev = Column("landing_revision", String(255), nullable=True, | |
104 | unique=False, default='tip') |
|
110 | unique=False, default='tip') | |
105 | landing_rev.create(table=tbl) |
|
111 | landing_rev.create(table=tbl) | |
@@ -110,6 +116,8 b' def upgrade(migrate_engine):' | |||||
110 | #========================================================================== |
|
116 | #========================================================================== | |
111 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import RepoGroup |
|
117 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import RepoGroup | |
112 | tbl = RepoGroup.__table__ |
|
118 | tbl = RepoGroup.__table__ | |
|
119 | ||||
|
120 | # add enable locking column | |||
113 | enable_locking = Column("enable_locking", Boolean(), nullable=True, |
|
121 | enable_locking = Column("enable_locking", Boolean(), nullable=True, | |
114 | unique=None, default=False) |
|
122 | unique=None, default=False) | |
115 | enable_locking.create(table=tbl) |
|
123 | enable_locking.create(table=tbl) | |
@@ -121,7 +129,7 b' def upgrade(migrate_engine):' | |||||
121 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import CacheInvalidation |
|
129 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import CacheInvalidation | |
122 | tbl = CacheInvalidation.__table__ |
|
130 | tbl = CacheInvalidation.__table__ | |
123 |
|
131 | |||
124 | # change column name -> firstname |
|
132 | # add INDEX for cache keys | |
125 | col = CacheInvalidation.__table__.columns.cache_key |
|
133 | col = CacheInvalidation.__table__.columns.cache_key | |
126 | col.alter(index=Index('key_idx', 'cache_key')) |
|
134 | col.alter(index=Index('key_idx', 'cache_key')) | |
127 |
|
135 | |||
@@ -131,7 +139,7 b' def upgrade(migrate_engine):' | |||||
131 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import Notification |
|
139 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import Notification | |
132 | tbl = Notification.__table__ |
|
140 | tbl = Notification.__table__ | |
133 |
|
141 | |||
134 | # change column name -> firstname |
|
142 | # add index for notification type | |
135 | col = Notification.__table__.columns.type |
|
143 | col = Notification.__table__.columns.type | |
136 | col.alter(index=Index('notification_type_idx', 'type'),) |
|
144 | col.alter(index=Index('notification_type_idx', 'type'),) | |
137 |
|
145 | |||
@@ -141,21 +149,26 b' def upgrade(migrate_engine):' | |||||
141 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import ChangesetComment |
|
149 | from rhodecode.lib.dbmigrate.schema.db_1_3_0 import ChangesetComment | |
142 |
|
150 | |||
143 | tbl = ChangesetComment.__table__ |
|
151 | tbl = ChangesetComment.__table__ | |
|
152 | col = ChangesetComment.__table__.columns.revision | |||
144 |
|
153 | |||
145 | col = ChangesetComment.__table__.columns.revision |
|
154 | # add index for revisions | |
146 | col.alter(index=Index('cc_revision_idx', 'revision'),) |
|
155 | col.alter(index=Index('cc_revision_idx', 'revision'),) | |
147 |
|
156 | |||
|
157 | # add hl_lines column | |||
148 | hl_lines = Column('hl_lines', Unicode(512), nullable=True) |
|
158 | hl_lines = Column('hl_lines', Unicode(512), nullable=True) | |
149 | hl_lines.create(table=tbl) |
|
159 | hl_lines.create(table=tbl) | |
150 |
|
160 | |||
|
161 | # add created_on column | |||
151 | created_on = Column('created_on', DateTime(timezone=False), nullable=True, |
|
162 | created_on = Column('created_on', DateTime(timezone=False), nullable=True, | |
152 | default=datetime.datetime.now) |
|
163 | default=datetime.datetime.now) | |
153 | created_on.create(table=tbl) |
|
164 | created_on.create(table=tbl) | |
154 | created_on.alter(nullable=False, default=datetime.datetime.now) |
|
165 | created_on.alter(nullable=False, default=datetime.datetime.now) | |
|
166 | ||||
155 | modified_at = Column('modified_at', DateTime(timezone=False), nullable=False, |
|
167 | modified_at = Column('modified_at', DateTime(timezone=False), nullable=False, | |
156 | default=datetime.datetime.now) |
|
168 | default=datetime.datetime.now) | |
157 | modified_at.alter(type=DateTime(timezone=False), table=tbl) |
|
169 | modified_at.alter(type=DateTime(timezone=False), table=tbl) | |
158 |
|
170 | |||
|
171 | # add FK to pull_request | |||
159 | pull_request_id = Column("pull_request_id", Integer(), |
|
172 | pull_request_id = Column("pull_request_id", Integer(), | |
160 | ForeignKey('pull_requests.pull_request_id'), |
|
173 | ForeignKey('pull_requests.pull_request_id'), | |
161 | nullable=True) |
|
174 | nullable=True) |
General Comments 0
You need to be logged in to leave comments.
Login now