repository: fixed a bug when scoped token was attached to repository, admins were unable to remove that repository.

This commit is contained in:
Marcin Lulek 2018-01-19 13:20:42 +01:00
parent e16b1eac92
commit 15fff6dafd
2 changed files with 3 additions and 0 deletions

View file

@ -1624,6 +1624,8 @@ class Repository(Base, BaseModel):
integrations = relationship('Integration',
cascade="all, delete, delete-orphan")
scoped_tokens = relationship('UserApiKeys', cascade="all")
def __unicode__(self):
return u"<%s('%s:%s')>" % (self.__class__.__name__, self.repo_id,
safe_unicode(self.repo_name))

View file

@ -6,6 +6,7 @@
(_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
(_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
(_('Cached Commit id'), lambda: h.link_to(c.rhodecode_db_repo.changeset_cache.get('short_id'), h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.changeset_cache.get('raw_id'))), '', ''),
(_('Attached scoped tokens'), len(c.rhodecode_db_repo.scoped_tokens), '', [x.user for x in c.rhodecode_db_repo.scoped_tokens]),
]
%>