Return 'user' role as default value
import django_openstack.urls


class Roles:
    USER = 'user'
    PROJECT_ADMIN = 'projadmin'
    SOFTWARE_ADMIN = 'softadmin'
    HARDWARE_ADMIN = 'hardadmin'
    ALL_ROLES = (HARDWARE_ADMIN, SOFTWARE_ADMIN,
                 PROJECT_ADMIN, USER)

    @staticmethod
    def get_max_role(roles):
        if not roles:
            return Roles.USER
        for role in Roles.ALL_ROLES:
            if role in roles:
                if role in django_openstack.urls.topbars:
                    return role
        return Roles.USER

    @staticmethod
    def needs_tenant(roles):
        return not (Roles.HARDWARE_ADMIN in roles) and not (Roles.SOFTWARE_ADMIN in roles)

import django_openstack.urls


class Roles:
    USER = 'user'
    PROJECT_ADMIN = 'projadmin'
    SOFTWARE_ADMIN = 'softadmin'
    HARDWARE_ADMIN = 'hardadmin'
    ALL_ROLES = (HARDWARE_ADMIN, SOFTWARE_ADMIN,
                 PROJECT_ADMIN, USER)

    @staticmethod
    def get_max_role(roles):
        if not roles:
            return Roles.USER
        for role in Roles.ALL_ROLES:
            if role in roles:
                if role in django_openstack.urls.topbars:
                    return role
                else:
                    return Roles.USER

    @staticmethod
    def needs_tenant(roles):
        return not (Roles.HARDWARE_ADMIN in roles) and not (Roles.SOFTWARE_ADMIN in roles)
