getByType() public method

Return all roles matching a specific type.
public getByType ( string $type ) : Gdn_DataSet
$type string Type slug to match role records against.
return Gdn_DataSet
Ejemplo n.º 1
0
 /**
  * Reset permissions for all roles, based on the value in their Type column.
  *
  * @param string $Type Role type to limit the updates to.
  */
 public static function resetAllRoles($Type = null)
 {
     // Retrieve an array containing all available roles.
     $RoleModel = new RoleModel();
     if ($Type) {
         $Result = $RoleModel->getByType($Type)->resultArray();
         $Roles = array_column($Result, 'Name', 'RoleID');
     } else {
         $Roles = $RoleModel->getArray();
     }
     // Iterate through our roles and reset their permissions.
     $Permissions = Gdn::permissionModel();
     foreach ($Roles as $RoleID => $Role) {
         $Permissions->resetRole($RoleID);
     }
 }