non-admin user attempting to create repository

Issue #280 invalid
Daniel LaMotte
created an issue
  • Created user "joeuser" without admin privileges.
  • Specifically give joeuser permission to "create repositories"
  • attempt to add repository via "Add New Repository" link on main page
  • Breaks with the following traceback

My database engine is PostgreSQL.

{{{

!python

2011-10-18 09:56:46.202 ERROR [rhodecode.model.repo] Traceback (most recent call last): File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/model/repo.py", line 233, in create form_data['clone_uri']) File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/model/repo.py", line 317, in create_repo [self.repos_path, new_parent_path, repo_name])) File "/pybubl/code/env/lib/python2.6/site-packages/vcs/utils/lazy.py", line 26, in get result = obj.dict[self.name] = self._func(obj) File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/model/repo.py", line 54, in repos_path q = self.sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one() File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 1989, in one ret = list(self) File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/model/caching_query.py", line 82, in iter return Query.iter(self) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 2031, in iter__ self.session._autoflush() File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 973, in _autoflush self.flush() File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 1547, in flush self._flush(objects) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 1616, in _flush flush_context.execute() File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py", line 328, in execute rec.execute(self) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py", line 472, in execute uow File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 2220, in _save_obj execute(statement, params) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1399, in execute params) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1532, in _execute_clauseelement compiled_sql, distilled_params File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_context context) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1633, in _execute_context context) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/default.py", line 330, in do_execute cursor.execute(statement, parameters) IntegrityError: (IntegrityError) duplicate key violates unique constraint "repo_to_perm_pkey" 'INSERT INTO repo_to_perm (user_id, permission_id, repository_id) VALUES (%(user_id)s, %(permission_id)s, %(repository_id)s) RETURNING repo_to_perm.repo_to_perm_id' {'repository_id': 8, 'permission_id': 2, 'user_id': 1}

2011-10-18 09:56:46.204 ERROR [rhodecode.controllers.admin.repos] Traceback (most recent call last): File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/controllers/admin/repos.py", line 160, in create repo_model.create(form_result, self.rhodecode_user) File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/model/repo.py", line 233, in create form_data['clone_uri']) File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/model/repo.py", line 317, in create_repo [self.repos_path, new_parent_path, repo_name])) File "/pybubl/code/env/lib/python2.6/site-packages/vcs/utils/lazy.py", line 26, in get result = obj.dict[self.name] = self._func(obj) File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/model/repo.py", line 54, in repos_path q = self.sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one() File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 1989, in one ret = list(self) File "/pybubl/code/env/lib/python2.6/site-packages/rhodecode/model/caching_query.py", line 82, in iter return Query.iter(self) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/query.py", line 2031, in iter__ self.session._autoflush() File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 973, in _autoflush self.flush() File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 1547, in flush self._flush(objects) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/session.py", line 1616, in _flush flush_context.execute() File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py", line 328, in execute rec.execute(self) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/unitofwork.py", line 472, in execute uow File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/orm/mapper.py", line 2220, in _save_obj execute(statement, params) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1399, in execute params) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1532, in _execute_clauseelement compiled_sql, distilled_params File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_context context) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/base.py", line 1633, in _execute_context context) File "/pybubl/code/env/lib/python2.6/site-packages/sqlalchemy/engine/default.py", line 330, in do_execute cursor.execute(statement, parameters) IntegrityError: (IntegrityError) duplicate key violates unique constraint "repo_to_perm_pkey" 'INSERT INTO repo_to_perm (user_id, permission_id, repository_id) VALUES (%(user_id)s, %(permission_id)s, %(repository_id)s) RETURNING repo_to_perm.repo_to_perm_id' {'repository_id': 8, 'permission_id': 2, 'user_id': 1}

}}}

Comments (2)

  1. Log in to comment