Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/model/medium/acl.php
<?php 


class AnModelMediumAcl extends KObject
{
	/**
	 * Return if the medium can be read
	 * @param $viewer
	 * @param $medium
	 * @return boolean
	 */
	public function canRead($viewer, $medium)
	{
		return !$viewer->isGuest() && $medium->owner->getAcl()->canReadMedium($medium);
	}
	
	/**
	 * Return if the medium can be edited
	 * @param $viewer
	 * @param $medium
	 * @return boolean
	 */
	public function canEdit($viewer, $medium)
	{
		return $this->canRead($viewer, $medium) && $medium->owner->getAcl()->canEditMedium($medium);
	}

	/**
	 * Return if the medium can be deleted
	 * @param $viewer
	 * @param $medium
	 * @return boolean
	 */
	public function canDelete($viewer, $medium)
	{		
		return $this->canEdit($viewer, $medium);
	}
	
	
	/**
	 * 
	 * @param $viewer
	 * @param $medium
	 * @return boolean
	 */
	public function canAddComment($viewer, $medium)
	{
		return $medium->openToComment && !$viewer->isGuest();
	}
	
	/**
	 * 
	 * @param $viewer
	 * @param $medium
	 * @param $comment
	 * @return boolean
	 */
	public function canEditComment($viewer, $medium, $comment)
	{
		return false && $viewer->id == $comment->author->id;
	}
	
	/**
	 * 
	 * @param $viewer
	 * @param $medium
	 * @param $comment
	 * @return boolean
	 */
	public function canDeleteComment($viewer, $medium, $comment)
	{
		return $viewer->isAdmin() || $medium->owner->id == $viewer->id || $viewer->id == $comment->author->id;
	}
	
}
?>
Return current item: Anahita Social Engine