Esempio n. 1
0
 /**
  * Answer true if the current user is an owner.
  * This method has been overridden to provide a quicker method of determination
  * when the slot is created with a course object.
  * 
  * @return boolean
  * @access public
  * @since 8/22/07
  */
 public function isUserOwner()
 {
     if (isset($this->course) && !is_null($this->course)) {
         // False if the user has been manually removed as an owner.
         if ($this->isUserRemovedOwner()) {
             return false;
         }
         // If they weren't manually removed and are listed as an instructor,
         // then they are an owner.
         if ($this->course->isUserInstructor()) {
             return true;
         }
         // Go through the internally defined owners and check them.
         // This is the same process the parent uses, we just want to avoid
         // loading checking all of the course members, since we already know
         // the result of that process for the current user (just above).
         $authN = Services::getService("AuthN");
         $userId = $authN->getFirstUserId();
         foreach (parent::getOwners() as $id) {
             if ($id->isEqual($userId)) {
                 return true;
             }
         }
         return false;
     }
     return parent::isUserOwner();
 }