<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Music_Plugin_Menus
{
  public function canCreatePlaylists()
  {
    // Must be logged in
    $viewer = Engine_Api::_()->user()->getViewer();
    if( !$viewer || !$viewer->getIdentity() ) {
      return false;
    }

    // Must be able to create playlists
    if( !Engine_Api::_()->authorization()->isAllowed('music_playlist', $viewer, 'create') ) {
      return false;
    }

    return true;
  }

  public function canViewPlaylists()
  {
    $viewer = Engine_Api::_()->user()->getViewer();
    
    // Must be able to view playlists
    if( !Engine_Api::_()->authorization()->isAllowed('music_playlist', $viewer, 'view') ) {
      return false;
    }

    return true;
  }
}
