public function addUserWriteAccess(a\User $u) { if (self::DEBUG) { u\DebugUtility::out("Granting write access to " . $u->getName()); } $this->setAccess($u, c\T::WRITE); return $this; }
public function addUserToSendReport(User $u) { if ($u == NULL) { throw new e\NullAssetException(S_SPAN . c\M::NULL_USER . E_SPAN); } $u_name = $u->getName(); $user_string = $this->getProperty()->sendReportToUsers; $user_array = explode(';', $user_string); if (!in_array($u_name, $user_array)) { $user_array[] = $u_name; } $user_string = implode(';', $user_array); $this->getProperty()->sendReportToUsers = $user_string; return $this; }
public function addUser(a\User $u) { if ($u == NULL) { throw new e\NullAssetException(S_SPAN . c\M::NULL_USER . E_SPAN); } $u_name = $u->getName(); $user_array = explode(self::DELIMITER, $this->users); $temp = array(); foreach ($user_array as $user) { if ($user != "") { $temp[] = $user; } } $user_array = $temp; if (!in_array($u_name, $user_array)) { $user_array[] = $u_name; } $this->users = implode(self::DELIMITER, $user_array); return $this; }
public function removeUser(User $u) { if (isset($u)) { $u_name = $u->getName(); // nothing to remove if ($this->getProperty()->users == "" || $this->getProperty()->users == NULL) { return $this; } else { $user_array = u\StringUtility::getExplodedStringArray(self::DELIMITER, $this->getUsers()); $temp = array(); foreach ($user_array as $user) { if ($user != $u_name) { $temp[] = $user; } } $this->getProperty()->users = implode(self::DELIMITER, $temp); } } return $this; }