Airship\Cabin\Bridge\Blueprint\Author::getAuthorIdsForUser PHP Method

getAuthorIdsForUser() public method

Get all of the authors available for this user to post under
public getAuthorIdsForUser ( integer $userid ) : array
$userid integer
return array
    public function getAuthorIdsForUser(int $userid) : array
    {
        $authors = $this->db->first('SELECT authorid FROM view_hull_users_authors WHERE userid = ?', $userid);
        if (empty($authors)) {
            return [];
        }
        return $authors;
    }

Usage Example

Beispiel #1
0
 /**
  * Permissions check
  *
  * @return bool
  */
 protected function permCheck() : bool
 {
     if ($this->isSuperUser()) {
         return true;
     }
     $authorsForUser = $this->author->getAuthorIdsForUser($this->getActiveUserId());
     // Check
     if (!\in_array($this->authorId, $authorsForUser)) {
         return false;
     }
     return true;
 }