Skip to content

Commit

Permalink
Merge 2e0a00e into 1560309
Browse files Browse the repository at this point in the history
  • Loading branch information
SamiHiltunen committed Oct 12, 2015
2 parents 1560309 + 2e0a00e commit c066f51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions invenio_ext/admin/views.py
Expand Up @@ -22,9 +22,11 @@
from __future__ import unicode_literals

from flask import abort, current_app

from flask_admin import AdminIndexView as FlaskAdminIndexView
from flask_admin import BaseView as FlaskBaseView
from flask_admin.contrib.sqla import ModelView as FlaskModelView

from flask_login import current_user

from invenio_ext.principal import permission_required
Expand All @@ -33,7 +35,6 @@

def can_acc_action(action):
"""Return getter/setter for can_<action> properties."""

def fget(self):
return self.acc_authorize(action)

Expand Down Expand Up @@ -68,7 +69,7 @@ def acc_authorize(self, action):
if action:
return permission_required(action)
else:
return current_user.is_super_admin
return current_user.is_superadmin

def _handle_view(self, name, **kwargs):
"""The method will be executed before calling any view method."""
Expand Down
6 changes: 4 additions & 2 deletions invenio_ext/login/legacy_user.py
Expand Up @@ -20,11 +20,13 @@
"""Provide support for legacy UserInfo object."""

from flask import current_app, has_request_context, request, session

from flask_login import UserMixin
from werkzeug.datastructures import CallbackDict, CombinedMultiDict

from invenio_ext.cache import cache

from werkzeug.datastructures import CallbackDict, CombinedMultiDict

__all__ = ('UserInfo', )

CFG_USER_DEFAULT_INFO = {
Expand Down Expand Up @@ -297,7 +299,7 @@ def is_admin(self):
return self.get('precached_useadmin', False)

@property
def is_super_admin(self):
def is_superadmin(self):
"""Check if user is super admin."""
return self.get('precached_usesuperadmin', False)

Expand Down

0 comments on commit c066f51

Please sign in to comment.