-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API Convert SecurityAdmin to be a ModelAdmin
Co-authored-by: Maxime Rainville <[email protected]>
- Loading branch information
1 parent
ec1111f
commit 40f1124
Showing
5 changed files
with
129 additions
and
312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace SilverStripe\Admin; | ||
|
||
use SilverStripe\Control\Controller; | ||
use SilverStripe\Security\Permission; | ||
use SilverStripe\View\Requirements; | ||
|
||
class MemberImportController extends Controller | ||
{ | ||
private static $allowed_actions = [ | ||
'MemberImportForm', | ||
'memberimport', | ||
'GroupImportForm', | ||
'groupimport', | ||
]; | ||
|
||
private static $url_segment = 'admin/member-import'; | ||
|
||
public function memberimport() | ||
{ | ||
Requirements::clear(); | ||
Requirements::javascript('silverstripe/admin: client/dist/js/vendor.js'); | ||
Requirements::javascript('silverstripe/admin: client/dist/js/MemberImportForm.js'); | ||
Requirements::css('silverstripe/admin: client/dist/styles/bundle.css'); | ||
return $this->renderWith('BlankPage', [ | ||
'Form' => $this->MemberImportForm()->forTemplate(), | ||
'Content' => ' ' | ||
]); | ||
} | ||
|
||
public function MemberImportForm(): MemberImportForm | ||
{ | ||
if (!Permission::check('ADMIN')) { | ||
return null; | ||
} | ||
return new MemberImportForm($this, __FUNCTION__); | ||
} | ||
|
||
public function groupimport() | ||
{ | ||
Requirements::clear(); | ||
Requirements::javascript('silverstripe/admin: client/dist/js/vendor.js'); | ||
Requirements::javascript('silverstripe/admin: client/dist/js/MemberImportForm.js'); | ||
Requirements::css('silverstripe/admin: client/dist/styles/bundle.css'); | ||
return $this->renderWith('BlankPage', [ | ||
'Content' => ' ', | ||
'Form' => $this->GroupImportForm()->forTemplate() | ||
]); | ||
} | ||
|
||
public function GroupImportForm(): GroupImportForm | ||
{ | ||
if (!Permission::check('ADMIN')) { | ||
return null; | ||
} | ||
return new GroupImportForm($this, __FUNCTION__); | ||
} | ||
} |
Oops, something went wrong.