Skip to content

Commit

Permalink
ENH Add generic types
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jan 11, 2024
1 parent 2734649 commit 1840d0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/MemberReportExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
use SilverStripe\Security\Group;
use SilverStripe\Security\Permission;
use SilverStripe\Security\LoginAttempt;
use SilverStripe\Security\Member;
use SilverStripe\Subsites\Model\Subsite;

/**
* Extends the {@see Member} class with additional descriptions for elements.
* See {@see UserSecurityReport} for usage.
*
* @extends DataExtension<Member>
*/
class MemberReportExtension extends DataExtension
{
Expand Down Expand Up @@ -63,7 +66,6 @@ public function getGroupsDescription()
// Collect the group names
$groupNames = array();
foreach ($groups as $group) {
/** @var Group $group */
$groupNames[] = html_entity_decode($group->getTreeTitle() ?? '');
}
// return a csv string of the group names, sans-markup
Expand Down
9 changes: 6 additions & 3 deletions src/Subsites/SubsiteMemberReportExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
namespace SilverStripe\SecurityReport\Subsites;

use SilverStripe\ORM\DataExtension;
use SilverStripe\Security\Member;
use SilverStripe\Subsites\Model\Subsite;

/**
* Adds 'SubsiteDescription' for to show which subsites this Member has edit access to
*
* @author Damian Mooyman <[email protected]>
*
* @extends DataExtension<Member>
*/
class SubsiteMemberReportExtension extends DataExtension
{

/**
* Set cast of additional field
*
Expand All @@ -22,15 +25,15 @@ class SubsiteMemberReportExtension extends DataExtension
private static $casting = array(
'SubsiteDescription' => 'Text'
);

/**
* Default permission to filter for
*
* @var string
* @config
*/
private static $subsite_description_permission = 'SITETREE_EDIT_ALL';

/**
* Describes the subsites this user has SITETREE_EDIT_ALL access to
*
Expand Down

0 comments on commit 1840d0d

Please sign in to comment.