@@ -32,15 +32,18 @@ import formencode
from pylons import tmpl_context as c, request, url
from pylons.controllers.util import redirect
from pylons.i18n.translation import _
import rhodecode.lib.helpers as h
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAllDecorator, \
NotAnonymous
from rhodecode.lib.base import BaseRepoController, render
from rhodecode.lib.utils import invalidate_cache, action_logger
from rhodecode.model.forms import RepoSettingsForm, RepoForkForm
from rhodecode.model.repo import RepoModel
from rhodecode.model.db import User
log = logging.getLogger(__name__)
@@ -154,12 +157,13 @@ class SettingsController(BaseRepoControl
except Exception:
h.flash(_('An error occurred during deletion of %s') % repo_name,
category='error')
return redirect(url('home'))
@NotAnonymous()
@HasRepoPermissionAllDecorator('repository.read')
def fork(self, repo_name):
repo_model = RepoModel()
c.repo_info = repo = repo_model.get_by_repo_name(repo_name)
if not repo:
h.flash(_('%s repository is not mapped to db perhaps'
@@ -169,13 +173,13 @@ class SettingsController(BaseRepoControl
return render('settings/repo_fork.html')
def fork_create(self, repo_name):
c.repo_info = repo_model.get_by_repo_name(repo_name)
_form = RepoForkForm(old_data={'repo_type':c.repo_info.repo_type})()
form_result = {}
@@ -30,12 +30,13 @@ import logging
import traceback
from decorator import decorator
from pylons import config, session, url, request
from pylons.controllers.util import abort, redirect
from rhodecode.lib.exceptions import LdapPasswordError, LdapUsernameError
from rhodecode.lib.utils import get_repo_slug
from rhodecode.lib.auth_ldap import AuthLdap
from rhodecode.model import meta
@@ -381,12 +382,16 @@ class NotAnonymous(object):
if request.environ.get('SCRIPT_NAME') != '/':
p += request.environ.get('SCRIPT_NAME')
p += request.environ.get('PATH_INFO')
if request.environ.get('QUERY_STRING'):
p += '?' + request.environ.get('QUERY_STRING')
h.flash(_('You need to be a registered user to perform this action'),
category='warning')
return redirect(url('login_home', came_from=p))
else:
return func(*fargs, **fkwargs)
class PermsDecorator(object):
"""Base class for decorators"""
@@ -9,13 +9,23 @@
<!-- stylesheets -->
<link rel="stylesheet" type="text/css" href="${h.url('/css/style.css')}" media="screen" />
</head>
<body>
<div id="login">
<div class="flash_msg">
<% messages = h.flash.pop_messages() %>
% if messages:
<ul id="flash-messages">
% for message in messages:
<li class="${message.category}_msg">${message}</li>
% endfor
</ul>
% endif
</div>
<!-- login -->
<div class="title top-left-rounded-corner top-right-rounded-corner">
<h5>${_('Sign In to')} ${c.rhodecode_name}</h5>
<div class="inner">
${h.form(h.url.current(came_from=c.came_from))}
Status change: