Version 5.0.0 beta 9
This commit is contained in:
1 parent
214f649f1d
commit
56979f8ee8
202 files changed
+4403
-1123
No files matched your search
@@ -18,6 +18,7 @@ use ErrorException;
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
use IPS\Application;
|
||||
use IPS\Application\Module;
|
||||
use IPS\cms\Databases;
|
||||
use IPS\cms\extensions\core\FrontNavigation\Pages;
|
||||
use IPS\cms\Templates;
|
||||
@@ -1690,6 +1691,32 @@ class Page extends Model implements Permissions
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check permissions
|
||||
*
|
||||
* @param mixed $permission A key which has a value in static::$permissionMap['view'] matching a column ID in core_permission_index
|
||||
* @param Group|Member|null $member The member or group to check (NULL for currently logged in member)
|
||||
* @param bool $considerPostBeforeRegistering If TRUE, and $member is a guest, will return TRUE if "Post Before Registering" feature is enabled
|
||||
* @return bool
|
||||
* @throws OutOfBoundsException If $permission does not exist in static::$permissionMap
|
||||
*/
|
||||
public function can( mixed $permission, Group|Member $member=NULL, bool $considerPostBeforeRegistering = TRUE ): bool
|
||||
{
|
||||
/* If this is a database page, check the Database module permissions.
|
||||
The Dispatcher thinks we are in the Pages module and so the permission check is done on the
|
||||
wrong module. */
|
||||
if( ( Dispatcher::hasInstance() AND Dispatcher::i()->controllerLocation == 'front' ) and $database = $this->getDatabase() )
|
||||
{
|
||||
$member = $member ?: Member::loggedIn();
|
||||
if( !$member->canAccessModule( Module::get( 'cms', 'database' ) ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::can( $permission, $member, $considerPostBeforeRegistering );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Database from the page
|
||||
*
|
||||
@@ -1984,7 +2011,7 @@ class Page extends Model implements Permissions
|
||||
*/
|
||||
public function getSortableName() : string
|
||||
{
|
||||
return $this->seo_name;
|
||||
return $this->seo_name ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user