Merge pull request #12736 from calbasi/master
[civicrm-core.git] / CRM / Utils / System / Soap.php
CommitLineData
40d837df
CW
1<?php
2/*
3 +--------------------------------------------------------------------+
fee14197 4 | CiviCRM version 5 |
40d837df 5 +--------------------------------------------------------------------+
8c9251b3 6 | Copyright CiviCRM LLC (c) 2004-2018 |
40d837df
CW
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 +--------------------------------------------------------------------+
d25dd0ee 26 */
40d837df
CW
27
28/**
29 *
30 * @package CRM
8c9251b3 31 * @copyright CiviCRM LLC (c) 2004-2018
40d837df
CW
32 */
33
34/**
b8c71ffa 35 * Soap specific stuff goes here.
40d837df
CW
36 */
37class CRM_Utils_System_Soap extends CRM_Utils_System_Base {
38
39 /**
fe482240 40 * UF container variables.
40d837df
CW
41 */
42 static $uf = NULL;
43 static $ufClass = NULL;
44
40d837df 45 /**
100fef9d 46 * Given a permission string, check for access requirements
40d837df 47 *
77855840
TO
48 * @param string $str
49 * The permission to check.
40d837df 50 *
d5cc0fc2 51 * @return bool
a6c01b45 52 * true if yes, else false
40d837df 53 */
00be9182 54 public function checkPermission($str) {
40d837df
CW
55 return TRUE;
56 }
57
58 /**
17f443df 59 * @inheritDoc
40d837df 60 */
00be9182 61 public function url($path = NULL, $query = NULL, $absolute = TRUE, $fragment = NULL) {
40d837df
CW
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 /**
17f443df
CW
73 * FIXME: Can this override be removed in favor of the parent?
74 * @inheritDoc
40d837df 75 */
00be9182 76 public function postURL($action) {
40d837df
CW
77 return NULL;
78 }
79
80 /**
fe482240 81 * Set the email address of the user.
40d837df 82 *
77855840
TO
83 * @param object $user
84 * Handle to the user object.
40d837df 85 */
e7292422
TO
86 public function setEmail(&$user) {
87 }
40d837df
CW
88
89 /**
17f443df 90 * @inheritDoc
40d837df 91 */
17f443df 92 public function authenticate($name, $pass) {
40d837df
CW
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 /**
fe482240 104 * Swap the current UF for soap.
40d837df
CW
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
40d837df
CW
116 /**
117 * Get user login URL for hosting CMS (method declared in each CMS system class)
118 *
77855840 119 * @param string $destination
40d837df 120 *
f4aaa82a 121 * @throws Exception
40d837df
CW
122 */
123 public function getLoginURL($destination = '') {
124 throw new Exception("Method not implemented: getLoginURL");
125 }
96025800 126
40d837df 127}