Backwards compatibility for user_permission

This commit is contained in:
Gina Häußge committed 2017-11-28 16:25:03 +01:00
1 parent fcd34265c8
commit 6b3d68f9aa
2 files changed
+14 -6

No files matched your search

+3
View File
@@ -16,6 +16,7 @@ from octoprint.access.permissions import Permissions, OctoPrintPermission
ADMIN_GROUP = "Admins"
DEFAULT_ADMIN_PERMISSIONS = [Permissions.ADMIN]
"""Default admin permissions are the legacy permissions from before 1.4.0"""
USER_GROUP = "Users"
DEFAULT_USER_PERMISSIONS = [Permissions.STATUS,
@@ -31,6 +32,7 @@ DEFAULT_USER_PERMISSIONS = [Permissions.STATUS,
Permissions.SLICE,
Permissions.TIMELAPSE,
Permissions.TIMELAPSE_ADMIN]
"""Default user permissions are the legacy permissions from before 1.4.0"""
GUEST_GROUP = "Guests"
DEFAULT_GUEST_PERMISSIONS = [Permissions.STATUS,
@@ -38,6 +40,7 @@ DEFAULT_GUEST_PERMISSIONS = [Permissions.STATUS,
Permissions.DOWNLOAD,
Permissions.TIMELAPSE,
Permissions.TERMINAL]
"""Default guest permissions are the legacy permissions from before 1.4.0"""
class GroupManager(object):
+11 -6
View File
@@ -67,13 +67,18 @@ principals = Principal(app)
import octoprint.access.permissions as permissions
# TODO deprecated, remove in future release
admin_permission = util.variable_deprecated("admin_permission has been deprecated, please use new Permissions.ADMIN instead", since="now")(
permissions.Permissions.ADMIN)
#user_permission = util.variable_deprecated("user_permission has been deprecated and will be removed in a future version", since="now")(
# permissions.Permissions.USER)
# we set admin_permission to Permissions.ADMIN
admin_permission = util.variable_deprecated("admin_permission has been deprecated, "
"please use individual Permissions instead",
since="1.4.0")(permissions.Permissions.SETTINGS)
# only import the octoprint stuff down here, as it might depend on things defined above to be initialized already
# we set user_permission to Permissions.STATUS, since that's the minimal permission a logged in user should
# probably have
user_permission = util.variable_deprecated("user_permission has been deprecated, "
"please use individual Permissions instead",
since="1.4.0")(permissions.Permissions.STATUS)
# only import further octoprint stuff down here, as it might depend on things defined above to be initialized already
from octoprint import __version__, __branch__, __display_version__, __revision__
from octoprint.printer.profile import PrinterProfileManager
from octoprint.printer.standard import Printer