From 0703c1a94ed4e22ff9af2de1037693513f4313aa Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Thu, 1 Nov 2018 09:28:05 +1300 Subject: [PATCH 1/2] API Deprecating Permission::$declared_permissions and related methods/props --- .upgrade.yml | 10 ++++++++++ src/Security/Permission.php | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/.upgrade.yml b/.upgrade.yml index 3b9616a95..81bc8a987 100644 --- a/.upgrade.yml +++ b/.upgrade.yml @@ -1281,6 +1281,12 @@ warnings: message: 'Removed SilverStripe\ORM\FieldType\DBDate->day_before()' 'days_between()': message: 'Removed SilverStripe\ORM\FieldType\DBDate->days_between()' + 'SilverStripe\Security\Permission::get_declared_permissions_list()': + message: 'Deprecated' + 'SilverStripe\Security\Permission::get_label_for_permission()': + message: 'Deprecated' + 'SilverStripe\Security\Permission::traverse_declared_permissions()': + message: 'Deprecated' props: 'class': message: '$this->class access has been removed' @@ -1312,6 +1318,10 @@ warnings: replacement: 'writeJavascriptToBody' 'SilverStripe\Forms\Formfield->dontEscape': message: 'FormField::$dontEscape has been removed. Escaping is now managed on a class by class basis.' + 'SilverStripe\Security\Permission::$declared_permissions': + message: 'Deprecated' + 'SilverStripe\Security\Permission::$declared_permissions_list': + message: 'Deprecated' functions: 'file_get_contents()': message: 'Use new asset abstraction' diff --git a/src/Security/Permission.php b/src/Security/Permission.php index 6c2553c13..1f529ce26 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -69,6 +69,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl * Method to globally disable "strict" checking, which means a permission * will be granted if the key does not exist at all. * + * @deprecated 4.4.0..5.0.0 * @var array */ private static $declared_permissions = null; @@ -76,6 +77,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl /** * Linear list of declared permissions in the system. * + * @deprecated 4.4.0..5.0.0 * @var array */ private static $declared_permissions_list = null; @@ -650,6 +652,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl * Get a linear list of the permissions in the system. * * @return array Linear list of declared permissions in the system. + * @deprecated 4.4.0..5.0.0 */ public static function get_declared_permissions_list() { @@ -673,6 +676,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl * * @param string $perm Permission code * @return string Label for the given permission, or the permission itself if the label doesn't exist + * @deprecated 4.4.0..5.0.0 */ public static function get_label_for_permission($perm) { @@ -690,6 +694,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl * @param array $declared Nested structure of permissions. * @param array $list List of permissions in the structure. The result will be * written to this array. + * @deprecated 4.4.0..5.0.0 */ protected static function traverse_declared_permissions($declared, &$list) { From 868258926ffe2bb303dc87d12bd3005a4dc2a821 Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Wed, 30 Jan 2019 11:57:17 +1300 Subject: [PATCH 2/2] Implement feedback on PSR-19 compatibility --- src/Security/Permission.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Security/Permission.php b/src/Security/Permission.php index 1f529ce26..39414ff28 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -69,7 +69,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl * Method to globally disable "strict" checking, which means a permission * will be granted if the key does not exist at all. * - * @deprecated 4.4.0..5.0.0 + * @deprecated 4.4.0 * @var array */ private static $declared_permissions = null; @@ -77,7 +77,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl /** * Linear list of declared permissions in the system. * - * @deprecated 4.4.0..5.0.0 + * @deprecated 4.4.0 * @var array */ private static $declared_permissions_list = null; @@ -652,7 +652,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl * Get a linear list of the permissions in the system. * * @return array Linear list of declared permissions in the system. - * @deprecated 4.4.0..5.0.0 + * @deprecated 4.4.0 */ public static function get_declared_permissions_list() { @@ -676,7 +676,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl * * @param string $perm Permission code * @return string Label for the given permission, or the permission itself if the label doesn't exist - * @deprecated 4.4.0..5.0.0 + * @deprecated 4.4.0 */ public static function get_label_for_permission($perm) { @@ -694,7 +694,7 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl * @param array $declared Nested structure of permissions. * @param array $list List of permissions in the structure. The result will be * written to this array. - * @deprecated 4.4.0..5.0.0 + * @deprecated 4.4.0 */ protected static function traverse_declared_permissions($declared, &$list) {