Bugfixes from tests

pull/1179/head
Ozzieisaacs 5 years ago
parent a9a6f5b97e
commit 317e59df4b

@ -338,7 +338,6 @@ def restriction_deletion(element, list_func):
@login_required @login_required
@admin_required @admin_required
def add_restriction(type): def add_restriction(type):
log.info("Hit: " + str(type))
element = request.form.to_dict() element = request.form.to_dict()
if type == 0: # Tags as template if type == 0: # Tags as template
if 'submit_allow' in element: if 'submit_allow' in element:
@ -713,6 +712,10 @@ def new_user():
languages=languages, title=_(u"Add new user"), page="newuser", languages=languages, title=_(u"Add new user"), page="newuser",
kobo_support=kobo_support, registered_oauth=oauth_check) kobo_support=kobo_support, registered_oauth=oauth_check)
try: try:
content.allowed_tags = config.config_allowed_tags
content.denied_tags = config.config_denied_tags
content.allowed_column_value = config.config_allowed_column_value
content.denied_column_value = config.config_denied_column_value
ub.session.add(content) ub.session.add(content)
ub.session.commit() ub.session.commit()
flash(_(u"User '%(user)s' created", user=content.nickname), category="success") flash(_(u"User '%(user)s' created", user=content.nickname), category="success")
@ -723,10 +726,6 @@ def new_user():
else: else:
content.role = config.config_default_role content.role = config.config_default_role
content.sidebar_view = config.config_default_show content.sidebar_view = config.config_default_show
content.allowed_tags = config.config_allowed_tags
content.denied_tags = config.config_denied_tags
content.allowed_column_value = config.config_allowed_column_value
content.allowed_column_value = config.config_denied_column_value
return render_title_template("user_edit.html", new_user=1, content=content, translations=translations, return render_title_template("user_edit.html", new_user=1, content=content, translations=translations,
languages=languages, title=_(u"Add new user"), page="newuser", languages=languages, title=_(u"Add new user"), page="newuser",
kobo_support=kobo_support, registered_oauth=oauth_check) kobo_support=kobo_support, registered_oauth=oauth_check)

@ -101,7 +101,7 @@ def load_user_from_kobo_request(request):
if user is not None: if user is not None:
login_user(user) login_user(user)
return user return user
log.info("Received Kobo request without a recognizable auth token.") log.debug("Received Kobo request without a recognizable auth token.")
return return
kobo_auth = Blueprint("kobo_auth", __name__, url_prefix="/kobo_auth") kobo_auth = Blueprint("kobo_auth", __name__, url_prefix="/kobo_auth")

@ -79,7 +79,7 @@
<input type="checkbox" name="Show_detail_random" id="Show_detail_random" {% if content.show_detail_random() %}checked{% endif %}> <input type="checkbox" name="Show_detail_random" id="Show_detail_random" {% if content.show_detail_random() %}checked{% endif %}>
<label for="Show_detail_random">{{_('Show random books in detail view')}}</label> <label for="Show_detail_random">{{_('Show random books in detail view')}}</label>
</div> </div>
{% if ( g.user and g.user.role_admin() ) %} {% if ( g.user and g.user.role_admin() and not new_user ) %}
<a href="#" id="get_user_tags" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/denied Tags')}}</a> <a href="#" id="get_user_tags" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/denied Tags')}}</a>
<a href="#" id="get_user_column_values" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/denied custom column values')}}</a> <a href="#" id="get_user_column_values" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/denied custom column values')}}</a>
{% endif %} {% endif %}

Loading…
Cancel
Save