Changeset 63

Show
Ignore:
Timestamp:
2009年02月24日 11时06分34秒 (3 years ago)
Author:
jiangx
Message:

Repository admin can not add / remove repository in repos controller and authz controller.

See #15.

Location:
trunk/pysvnmanager
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/pysvnmanager/controllers/authz.py

    r62 r63  
    5555    def index(self): 
    5656        c.revision = self.authz.version 
     57        c.is_super_user = self.is_super_user 
    5758        # used for functional test. 
    5859        c.reposlist = self.own_reposlist 
     
    181182        try: 
    182183            if isAddRepos: 
     184                if not self.is_super_user: 
     185                    raise Exception("Access denied.") 
    183186                repos = self.authz.add_repos(reposname) 
    184187            else: 
    185188                repos = self.authz.get_repos(reposname) 
    186189                if not repos: 
     190                    if not self.is_super_user: 
     191                        raise Exception("Access denied.") 
    187192                    log.warning("Repos '%s' not exists. Create authz config automatically." % reposname) 
    188193                    repos = self.authz.add_repos(reposname) 
  • trunk/pysvnmanager/controllers/repos.py

    r62 r63  
    5656         
    5757    def index(self): 
     58        c.is_super_user = self.is_super_user 
    5859        return render('/repos/hooks.mako') 
    5960 
     
    206207         
    207208    def create(self): 
     209        if not self.is_super_user: 
     210            return redirect_to(h.url_for(controller='security', action='failed')) 
    208211        return render('/repos/create.mako') 
    209212 
     
    223226     
    224227    def remove(self): 
     228        if not self.is_super_user: 
     229            return redirect_to(h.url_for(controller='security', action='failed')) 
    225230        return render('/repos/remove.mako') 
  • trunk/pysvnmanager/templates/authz/index.mako

    r45 r63  
    598598    <select name="repos_list" size="1" onChange='repos_changed()'> 
    599599    </select> 
    600 <a href="#" onclick='new_repos()'>[+${_("New repository")}]</a> 
     600% if c.is_super_user: 
     601    <a href="#" onclick='new_repos()'>[+${_("New repository")}]</a> 
     602% endif 
    601603</DIV> 
    602604 
  • trunk/pysvnmanager/templates/repos/hooks.mako

    r55 r63  
    189189    <select name="repos_list" size="1" onChange='repos_changed()'> 
    190190    </select> 
    191 ${h.link_to(_("Add repository"), h.url_for(action="create"))} 
    192 ${h.link_to(_("Remove repository"), h.url_for(action="remove"))} 
     191% if c.is_super_user: 
     192    ${h.link_to(_("Add repository"), h.url_for(action="create"))} 
     193    ${h.link_to(_("Remove repository"), h.url_for(action="remove"))} 
     194% endif 
    193195</DIV> 
    194196