Skip to content

Commit

Permalink
Merge pull request #1453 from creative-commoners/pulls/1/depr
Browse files Browse the repository at this point in the history
API Deprecate SecurityAdmin API
  • Loading branch information
GuySartorelli authored Feb 7, 2023
2 parents 22ddda9 + 3eb85e5 commit 304a4d2
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
6 changes: 5 additions & 1 deletion code/GroupImportForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@
use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\Security\Group;
use SilverStripe\Security\GroupCsvBulkLoader;
use SilverStripe\Dev\Deprecation;

/**
* Imports {@link Group} records by CSV upload, as defined in
* {@link GroupCsvBulkLoader}.
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
class GroupImportForm extends Form
{

/**
* @var Group Optional group relation
*/
protected $group;

public function __construct($controller, $name, $fields = null, $actions = null, $validator = null)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
});
if (!$fields) {
$helpHtml = _t(
__CLASS__ . '.Help1',
Expand Down
6 changes: 5 additions & 1 deletion code/MemberImportForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,25 @@
use SilverStripe\Forms\RequiredFields;
use SilverStripe\Forms\Form;
use SilverStripe\View\Requirements;
use SilverStripe\Dev\Deprecation;

/**
* Imports {@link Member} records by CSV upload, as defined in
* {@link MemberCsvBulkLoader}.
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
class MemberImportForm extends Form
{

/**
* @var Group Optional group relation
*/
protected $group;

public function __construct($controller, $name, $fields = null, $actions = null, $validator = null)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
});
if (!$fields) {
$helpHtml = _t(
__CLASS__ . '.Help1',
Expand Down
41 changes: 40 additions & 1 deletion code/SecurityAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Convert;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\Deprecation;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\GridField\GridField;
Expand All @@ -30,6 +31,8 @@

/**
* Security section of the CMS
*
* Note: In CMS 5 SecurityAdmin will extend ModelAdmin instead of LeftAndMain
*/
class SecurityAdmin extends LeftAndMain implements PermissionProvider
{
Expand All @@ -43,7 +46,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider
private static $tree_class = Group::class;

/**
* @deprecated 1.13.0 Do not use this options.
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
* @config
*/
private static $subitem_class = Member::class;
Expand All @@ -68,9 +71,13 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider
*
* @param HTTPRequest $request
* @return HTTPResponse
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
public function users($request)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it.');
});
return $this->index($request);
}

Expand All @@ -79,9 +86,13 @@ public function users($request)
*
* @param HTTPRequest $request
* @return HTTPResponse
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
public function groups($request)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it.');
});
return $this->index($request);
}

Expand All @@ -90,9 +101,13 @@ public function groups($request)
*
* @param HTTPRequest $request
* @return HTTPResponse
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
public function roles($request)
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it.');
});
return $this->index($request);
}

Expand Down Expand Up @@ -214,8 +229,14 @@ public function getEditForm($id = null, $fields = null)
return $form;
}

/**
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
public function memberimport()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it.');
});
Requirements::clear();
Requirements::javascript('silverstripe/admin: client/dist/js/vendor.js');
Requirements::javascript('silverstripe/admin: client/dist/js/MemberImportForm.js');
Expand All @@ -231,9 +252,13 @@ public function memberimport()
* @see SecurityAdmin_MemberImportForm
*
* @return Form
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
public function MemberImportForm()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it.');
});
if (!Permission::check('ADMIN')) {
return null;
}
Expand All @@ -246,8 +271,14 @@ public function MemberImportForm()
return $form;
}

/**
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
public function groupimport()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it.');
});
Requirements::clear();
Requirements::javascript('silverstripe/admin: client/dist/js/vendor.js');
Requirements::javascript('silverstripe/admin: client/dist/js/MemberImportForm.js');
Expand All @@ -264,9 +295,13 @@ public function groupimport()
*
* @skipUpgrade
* @return Form
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
public function GroupImportForm()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it.');
});
if (!Permission::check('ADMIN')) {
return null;
}
Expand All @@ -276,9 +311,13 @@ public function GroupImportForm()

/**
* Disable GridFieldDetailForm backlinks for this view, as its
* @deprecated 1.13.0 Will be removed without equivalent functionality to replace it
*/
public function Backlink()
{
Deprecation::withNoReplacement(function () {
Deprecation::notice('1.13.0', 'Will be removed without equivalent functionality to replace it.');
});
return false;
}

Expand Down

0 comments on commit 304a4d2

Please sign in to comment.