Subversion Repositories oidplus

Rev

Rev 279 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
256 daniel-mar 1
<?php
2
 
3
/*
4
 * OIDplus 2.0
5
 * Copyright 2019 Daniel Marschall, ViaThinkSoft
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.
9
 * You may obtain a copy of the License at
10
 *
11
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 */
19
 
20
class OIDplusPagePublicRaBaseUtils extends OIDplusPagePluginPublic {
21
 
22
        public function action(&$handled) {
23
 
24
                // Action:     delete_ra
25
                // Method:     POST
26
                // Parameters: email
27
                // Outputs:    Text
28
                if (isset($_POST["action"]) && ($_POST["action"] == "delete_ra")) {
29
                        $handled = true;
30
 
31
                        $email = $_POST['email'];
32
 
33
                        $ra_logged_in = OIDplus::authUtils()->isRaLoggedIn($email);
34
 
35
                        if (!OIDplus::authUtils()->isAdminLoggedIn() && !$ra_logged_in) {
36
                                throw new OIDplusException('Authentification error. Please log in.');
37
                        }
38
 
39
                        if ($ra_logged_in) OIDplus::authUtils()->raLogout($email);
40
 
41
                        $ra = new OIDplusRA($email);
42
                        if (!$ra->existing()) {
43
                                throw new OIDplusException("RA '$email' does not exist.");
44
                        }
45
                        $ra->delete();
46
                        $ra = null;
47
 
48
                        OIDplus::logger()->log("RA($email)?/A?", "RA '$email' deleted");
49
 
50
                        echo json_encode(array("status" => 0));
51
                }
52
 
53
        }
54
 
55
        public function init($html=true) {
259 daniel-mar 56
                // Will be used by: plugins admin-130, public-091, public-200, ra-092, ra-101
263 daniel-mar 57
                OIDplus::config()->prepareConfigKey('ra_min_password_length', 'Minimum length for RA passwords', '6', OIDplusConfig::PROTECTION_EDITABLE, function($value) {
257 daniel-mar 58
                        if (!is_numeric($value) || ($value < 1)) {
59
                                throw new OIDplusException("Please enter a valid password length.");
60
                        }
263 daniel-mar 61
                });
256 daniel-mar 62
        }
63
 
64
        public function gui($id, &$out, &$handled) {
65
        }
66
 
282 daniel-mar 67
        public function publicSitemap(&$out) {
68
        }
69
 
256 daniel-mar 70
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
71
        }
72
 
73
        public function tree_search($request) {
74
                return false;
75
        }
76
}