~dangarner/xibo/server-layout-media-permissions

« back to all changes in this revision

Viewing changes to server/lib/service/xmdssoap.class.php

  • Committer: Dan Garner
  • Date: 2011-08-18 23:34:53 UTC
  • Revision ID: dan@xibo.org.uk-20110818233453-q1cz35j6jb483v70
[server] Tweaks to permissions. XMDS to have GetResource call. Other small changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
908
908
    }
909
909
 
910
910
    /**
 
911
     * Gets additional resources for assigned media
 
912
     * @param <type> $serverKey
 
913
     * @param <type> $hardwareKey
 
914
     * @param <type> $layoutId
 
915
     * @param <type> $regionId
 
916
     * @param <type> $mediaId
 
917
     * @param <type> $version
 
918
     */
 
919
    function GetResource($serverKey, $hardwareKey, $layoutId, $regionId, $mediaId, $version)
 
920
    {
 
921
        $db =& $this->db;
 
922
 
 
923
        // Sanitize
 
924
        $serverKey = Kit::ValidateParam($serverKey, _STRING);
 
925
        $hardwareKey = Kit::ValidateParam($hardwareKey, _STRING);
 
926
        $layoutId = Kit::ValidateParam($layoutId, _INT);
 
927
        $regionId = Kit::ValidateParam($regionId, _STRING);
 
928
        $mediaId = Kit::ValidateParam($mediaId, _STRING);
 
929
        $version = Kit::ValidateParam($version, _STRING);
 
930
 
 
931
        // Make sure we are talking the same language
 
932
        if (!$this->CheckVersion($version))
 
933
        {
 
934
            throw new SoapFault('Receiver', "Your client is not of the correct version for communication with this server. You can get the latest from http://www.xibo.org.uk");
 
935
        }
 
936
 
 
937
        // Auth this request...
 
938
        if (!$this->AuthDisplay($hardwareKey))
 
939
        {
 
940
            throw new SoapFault('Receiver', "This display client is not licensed");
 
941
        }
 
942
 
 
943
        // What type of module is this?
 
944
        Kit::ClassLoader('region');
 
945
        $region = new region($db, null);
 
946
        $type = $region->GetMediaNodeType($layoutId, $regionId, $mediaId);
 
947
 
 
948
        if ($type == '')
 
949
            throw new SoapFault('Receiver', 'Unable to get the media node type');
 
950
 
 
951
        // Get the resource from the module
 
952
        require_once('modules/' . $type . '.module.php');
 
953
        $module = new $type($db, null, $mediaid, $layoutid, $regionid, $lkid);
 
954
        $resource = $module->GetResource();
 
955
 
 
956
        if (!$resource || $resource == '')
 
957
            throw new SoapFault('Receiver', 'Unable to get the media resource');
 
958
 
 
959
        return $resource;
 
960
    }
 
961
 
 
962
    /**
911
963
     * Authenticates the display
912
964
     * @param <type> $hardwareKey
913
965
     * @return <type>