Short array syntax - auto-format CRM directory
[civicrm-core.git] / CRM / Utils / System / Soap.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2019
32 */
33
34 /**
35 * Soap specific stuff goes here.
36 */
37 class CRM_Utils_System_Soap extends CRM_Utils_System_Base {
38
39 /**
40 * UF container variables.
41 */
42 static $uf = NULL;
43 static $ufClass = NULL;
44
45 /**
46 * Given a permission string, check for access requirements
47 *
48 * @param string $str
49 * The permission to check.
50 *
51 * @return bool
52 * true if yes, else false
53 */
54 public function checkPermission($str) {
55 return TRUE;
56 }
57
58 /**
59 * @inheritDoc
60 */
61 public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
62 if (isset(self::$ufClass)) {
63 $className = self::$ufClass;
64 $url = $className::url($path, $query, $absolute, $fragment);
65 return $url;
66 }
67 else {
68 return NULL;
69 }
70 }
71
72 /**
73 * FIXME: Can this override be removed in favor of the parent?
74 * @inheritDoc
75 */
76 public function postURL($action) {
77 return NULL;
78 }
79
80 /**
81 * Set the email address of the user.
82 *
83 * @param object $user
84 * Handle to the user object.
85 */
86 public function setEmail(&$user) {
87 }
88
89 /**
90 * @inheritDoc
91 */
92 public function authenticate($name, $pass) {
93 if (isset(self::$ufClass)) {
94 $className = self::$ufClass;
95 $result =& $className::authenticate($name, $pass);
96 return $result;
97 }
98 else {
99 return NULL;
100 }
101 }
102
103 /**
104 * Swap the current UF for soap.
105 */
106 public function swapUF() {
107 $config = CRM_Core_Config::singleton();
108
109 self::$uf = $config->userFramework;
110 $config->userFramework = 'Soap';
111
112 self::$ufClass = $config->userFrameworkClass;
113 $config->userFrameworkClass = 'CRM_Utils_System_Soap';
114 }
115
116 /**
117 * Get user login URL for hosting CMS (method declared in each CMS system class)
118 *
119 * @param string $destination
120 *
121 * @throws Exception
122 */
123 public function getLoginURL($destination = '') {
124 throw new Exception("Method not implemented: getLoginURL");
125 }
126
127 public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
128 // It makes zero sense for this class to extend CRM_Utils_System_Base.
129 throw new \RuntimeException("Not implemented");
130 }
131
132 }