forked from GNUsocial/gnu-social
Add Profile::ensureCurrent() to verify we _certainly_ got a Profile.
This commit is contained in:
parent
f10625f8bc
commit
5dce08d068
@ -1628,6 +1628,15 @@ class Profile extends Managed_DataObject
|
||||
return $profile;
|
||||
}
|
||||
|
||||
static function ensureCurrent()
|
||||
{
|
||||
$profile = self::current();
|
||||
if (!$profile instanceof Profile) {
|
||||
throw new AuthorizationException('A currently scoped profile is required.');
|
||||
}
|
||||
return $profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic function called at serialize() time.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user