aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorMikael Nordfeldth <mmn@hethane.se>2016-02-12 13:52:48 +0100
committerMikael Nordfeldth <mmn@hethane.se>2016-02-12 13:52:48 +0100
commit5dce08d068b13353ad7bb4de339f4a4996710aff (patch)
treecaa3ccdcd5d80f8c115639c8b36b367b90ccee25 /classes
parentf10625f8bc59e3ae52da07fdba910329fad540a3 (diff)
downloadgnu-social-5dce08d068b13353ad7bb4de339f4a4996710aff.tar
gnu-social-5dce08d068b13353ad7bb4de339f4a4996710aff.zip
Add Profile::ensureCurrent() to verify we _certainly_ got a Profile.
Diffstat (limited to 'classes')
-rw-r--r--classes/Profile.php9
1 files changed, 9 insertions, 0 deletions
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.
*