Merge pull request #14077 from pradpnayak/AutoComplete
[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 * @var string
42 */
43 public static $uf = NULL;
44 public static $ufClass = NULL;
45
46 /**
47 * Given a permission string, check for access requirements
48 *
49 * @param string $str
50 * The permission to check.
51 *
52 * @return bool
53 * true if yes, else false
54 */
55 public function checkPermission($str) {
56 return TRUE;
57 }
58
59 /**
60 * @inheritDoc
61 */
62 public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
63 if (isset(self::$ufClass)) {
64 $className = self::$ufClass;
65 $url = $className::url($path, $query, $absolute, $fragment);
66 return $url;
67 }
68 else {
69 return NULL;
70 }
71 }
72
73 /**
74 * FIXME: Can this override be removed in favor of the parent?
75 * @inheritDoc
76 */
77 public function postURL($action) {
78 return NULL;
79 }
80
81 /**
82 * Set the email address of the user.
83 *
84 * @param object $user
85 * Handle to the user object.
86 */
87 public function setEmail(&$user) {
88 }
89
90 /**
91 * @inheritDoc
92 */
93 public function authenticate($name, $pass) {
94 if (isset(self::$ufClass)) {
95 $className = self::$ufClass;
96 $result =& $className::authenticate($name, $pass);
97 return $result;
98 }
99 else {
100 return NULL;
101 }
102 }
103
104 /**
105 * Swap the current UF for soap.
106 */
107 public function swapUF() {
108 $config = CRM_Core_Config::singleton();
109
110 self::$uf = $config->userFramework;
111 $config->userFramework = 'Soap';
112
113 self::$ufClass = $config->userFrameworkClass;
114 $config->userFrameworkClass = 'CRM_Utils_System_Soap';
115 }
116
117 /**
118 * Get user login URL for hosting CMS (method declared in each CMS system class)
119 *
120 * @param string $destination
121 *
122 * @throws Exception
123 */
124 public function getLoginURL($destination = '') {
125 throw new Exception("Method not implemented: getLoginURL");
126 }
127
128 public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE, $realPath = NULL) {
129 // It makes zero sense for this class to extend CRM_Utils_System_Base.
130 throw new \RuntimeException("Not implemented");
131 }
132
133 }