Changeset - 8f3cc21d83e6
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2013-01-28 21:14:46
marcin@python-works.com
fixes issue #739 Delete/Edit repositories should only point to admin links if the user is an super admin.
3 files changed with 24 insertions and 10 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/admin/repos.py
Show inline comments
 
@@ -138,7 +138,8 @@ class ReposController(BaseController):
 
                        .all()
 

	
 
        repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
 
                                                   admin=True)
 
                                                   admin=True,
 
                                                   super_user_actions=True)
 
        #json used to render the grid
 
        c.data = json.dumps(repos_data)
 

	
rhodecode/model/repo.py
Show inline comments
 
@@ -143,7 +143,8 @@ class RepoModel(BaseModel):
 
        kwargs.update(dict(_=_, h=h, c=c))
 
        return tmpl.render(*args, **kwargs)
 

	
 
    def get_repos_as_dict(self, repos_list=None, admin=False, perm_check=True):
 
    def get_repos_as_dict(self, repos_list=None, admin=False, perm_check=True,
 
                          super_user_actions=False):
 
        _render = self._render_datatable
 

	
 
        def quick_menu(repo_name):
 
@@ -175,7 +176,7 @@ class RepoModel(BaseModel):
 
                return h.urlify_text(h.truncate(desc, 60))
 

	
 
        def repo_actions(repo_name):
 
            return _render('repo_actions', repo_name)
 
            return _render('repo_actions', repo_name, super_user_actions)
 

	
 
        def owner_actions(user_id, username):
 
            return _render('user_name', user_id, username)
rhodecode/templates/data_table/_dt_elements.html
Show inline comments
 
@@ -110,17 +110,29 @@
 
    <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(email, size)}"/> </div>
 
</%def>
 

	
 
<%def name="repo_actions(repo_name)">
 
<%def name="repo_actions(repo_name, super_user=True)">
 
  <div>
 
    <div style="float:left">
 
    <a href="${h.url('repo_settings_home',repo_name=repo_name)}" title="${_('edit')}">
 
      ${h.submit('edit_%s' % repo_name,_('edit'),class_="edit_icon action_button")}
 
    </a>
 
    %if super_user:
 
      <a href="${h.url('edit_repo',repo_name=repo_name)}" title="${_('edit')}">
 
        ${h.submit('edit_%s' % repo_name,_('edit'),class_="edit_icon action_button")}
 
      </a>
 
    %else:
 
      <a href="${h.url('repo_settings_home',repo_name=repo_name)}" title="${_('edit')}">
 
        ${h.submit('edit_%s' % repo_name,_('edit'),class_="edit_icon action_button")}
 
      </a>
 
    %endif
 
    </div>
 
    <div style="float:left">
 
    ${h.form(h.url('repo', repo_name=repo_name),method='delete')}
 
      ${h.submit('remove_%s' % repo_name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
 
    ${h.end_form()}
 
    %if super_user:
 
      ${h.form(h.url('repo', repo_name=repo_name),method='delete')}
 
        ${h.submit('remove_%s' % repo_name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
 
      ${h.end_form()}
 
    %else:
 
      ${h.form(h.url('repo_settings_delete', repo_name=repo_name),method='delete')}
 
        ${h.submit('remove_%s' % repo_name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
 
      ${h.end_form()}        
 
    %endif
 
    </div>
 
  </div>
 
</%def>
0 comments (0 inline, 0 general)