diff --git a/classes/Profile.php b/classes/Profile.php index 875ad9ade1..e4ab508c06 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -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. *