Exemplo n.º 1
0
 public function canEdit()
 {
     if (!parent::canEdit()) {
         return false;
     }
     if ($this->event_private && $this->event_owner != $this->_AppUI->user_id) {
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
 public function canEdit()
 {
     $result = false;
     if (parent::canEdit() || $this->user_id == $this->_AppUI->user_id) {
         $result = true;
     }
     return $result;
 }
Exemplo n.º 3
0
 public function canEdit()
 {
     $q = $this->_getQuery();
     $q->addQuery('user_contact');
     $q->addTable('users');
     $q->addWhere('user_id = ' . $this->_AppUI->user_id);
     $contact_id = $q->loadResult();
     /* A user can *always* edit themselves. */
     if ($this->contact_id == $contact_id) {
         return true;
     }
     $thisCanEdit = false;
     $baseCanEdit = parent::canEdit();
     $tmp = new CContact();
     $tmp->overrideDatabase($this->_query);
     $tmp->load($this->contact_id);
     /*
      * This check is one of the more complex ones.. it will only allow the user
      *   to edit the contact if either:
      *     a) the contact is not private; OR
      *     b) the contact is private and the user is the contact owner.
      */
     if (!$tmp->contact_private || $tmp->contact_private && $tmp->contact_owner == $this->_AppUI->user_id) {
         $thisCanEdit = true;
     }
     return $thisCanEdit && $baseCanEdit;
 }