Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/model/person/acl.php
<?php
/**
 * @version		1.0.0
 * @category	Anahita Social Engine™
 * @copyright	Copyright (C) 2008 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.anahitapolis.com
 */

class AnModelPersonAcl extends AnModelActorAcl
{		
	public function canUseApplication($viewer, $owner, $application)
	{
		return true;
	}
	
	public function canAddStory($viewer, $person)
	{	
		return !$viewer->isGuest();
	}
	
	public function canSeeAvatar($viewer, $person)
	{
		return false;
	}
	
	public function canUpdateAvatar($viewer, $person)
	{
		return $viewer === $person || $viewer->isAdmin();
	}
	
	public function canUpdateInformation($viewer, $person)
	{
		return $viewer->isAdmin() || $viewer === $person;
	}
		
	public function canViewSocialgraph($viewer, $person)
	{
		return true;
	}
	
	public function canFollow($viewer, $person)
	{
		return !$viewer->isGuest() && $viewer !== $person 
			&& !$viewer->isFollowing($person) 
			&& !$viewer->isBlocking($person)
			;
	}
	
	public function canBlock($viewer, $person)
	{
		return !$viewer->isGuest() && !$person->isAdmin() 
				&& $viewer !== $person 
				&& !$viewer->isBlocking($person);
	}
		
	public function canSeePersonalInformation($viewer, $person, $information)
	{
		return true;	
	}
	
	public function canDelete($viewer, $person)
	{
		return false;
	}
	
	public function canReadMedium($viewer, $person, $medium)
	{
		return true;
	}
	
	public function canAddMedium($viewer, $person, $medium=null)
	{
		return $viewer->id == $person->id;
	}
	
	public function canEditMedium($viewer, $person, $medium)
	{
		return $viewer->isAdmin() || ($viewer->id == $person->id);
	}
	
	public function canDeleteMedium($viewer, $person, $medium)
	{
		return $viewer->isAdmin() || ($viewer->id == $person->id);
	}

	public function canSaveApplicationSetting($viewer, $person, $application)
	{
		return $viewer->eql($person);
	}
	public function canRemoveApplication($viewer, $person, $application)
	{
		if ( $application->component == 'com_socialengine' )
			return false;
			
		return $application->getSetting($person)->addedToProfile && !$application->isGlobal;
	}
	
	public function canAddApplication($viewer, $person, $application)
	{
		if ( $application->component == 'com_socialengine' )
			return false;

		return $application->enabled && !$application->isGlobal && !$application->getSetting($person)->addedToProfile;
	}
//end class
}
Return current item: Anahita Social Engine