/** * Bind improliga permission rules to the visibility status. User * must have right to see the object to manipulate with it. * * @param string $method * @param \System\User $user * @return bool */ public function can_be($method, \System\User $user) { $can_he = parent::can_be($method, $user); if (!$can_he) { $is_visible = $this->is_visible_for($user); } return $can_he; }
public function save() { parent::save(); if (!$this->symvar) { $this->symvar = self::create_symvar($this->id); $this->save(); } }
public function save() { $is_new = $this->is_new(); parent::save(); if ($is_new) { $this->send_invites(); } return $this; }
public function save() { parent::save(); if (!$this->ident) { $this->ident = md5($this->id . '-' . time()); $this->save(); } return $this; }
public function save() { parent::save(); $change = empty($this->data_initial['status']) || $this->data_initial['status'] != $this->status; if ($change) { $this->update_alert(); if ($this->training && $this->training->lector && $this->training->lector->id != $this->user->id) { $this->report_status(); } } return $this; }
public static function get_visible_schema(\System\User $user) { $schema = parent::get_visible_schema($user); array_push($schema['attrs'], array("name" => 'name', "type" => 'string', "is_fake" => true)); return $schema; }
public function to_object_with_perms(\System\User $user) { $data = parent::to_object_with_perms($user); $data['free'] = $this->opened - $this->assignees->count(); return $data; }