X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fuser.php;h=7461573c1e855d77abe887e8af38199f67b4accd;hb=3af21f99b63b468a5327c36d7ed3a13303c7a06f;hp=2e23ff005d9b33279423d410d40816645b73d507;hpb=efe597c5795234724bc3df508bd628f9860a9c32;p=platal.git diff --git a/classes/user.php b/classes/user.php index 2e23ff0..7461573 100644 --- a/classes/user.php +++ b/classes/user.php @@ -245,6 +245,18 @@ class User extends PlUser return !is_null($this->profile()); } + /** Check if the user can edit to given profile. + */ + public function canEdit(Profile $profile) + { + // XXX: Check permissions (e.g. secretary permission) + // and flags from the profile + return XDB::fetchOneCell('SELECT pid + FROM account_profiles + WHERE uid = {?} AND pid = {?}', + $this->id(), $profile->id()); + } + /** Get the email alias of the user. */ public function emailAlias()