This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Alpha\Model; |
||
4 | |||
5 | use Alpha\Model\Type\SmallText; |
||
6 | use Alpha\Model\Type\Relation; |
||
7 | use Alpha\Util\Logging\Logger; |
||
8 | |||
9 | /** |
||
10 | * The group level rights object for the application permissions. |
||
11 | * |
||
12 | * @since 1.0 |
||
13 | * |
||
14 | * @author John Collins <[email protected]> |
||
15 | * @license http://www.opensource.org/licenses/bsd-license.php The BSD License |
||
16 | * @copyright Copyright (c) 2018, John Collins (founder of Alpha Framework). |
||
17 | * All rights reserved. |
||
18 | * |
||
19 | * <pre> |
||
20 | * Redistribution and use in source and binary forms, with or |
||
21 | * without modification, are permitted provided that the |
||
22 | * following conditions are met: |
||
23 | * |
||
24 | * * Redistributions of source code must retain the above |
||
25 | * copyright notice, this list of conditions and the |
||
26 | * following disclaimer. |
||
27 | * * Redistributions in binary form must reproduce the above |
||
28 | * copyright notice, this list of conditions and the |
||
29 | * following disclaimer in the documentation and/or other |
||
30 | * materials provided with the distribution. |
||
31 | * * Neither the name of the Alpha Framework nor the names |
||
32 | * of its contributors may be used to endorse or promote |
||
33 | * products derived from this software without specific |
||
34 | * prior written permission. |
||
35 | * |
||
36 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
||
37 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
||
38 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
||
39 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
40 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
||
41 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||
42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
43 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
44 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||
45 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
46 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
||
47 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
48 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
49 | * </pre> |
||
50 | */ |
||
51 | class Rights extends ActiveRecord |
||
52 | { |
||
53 | /** |
||
54 | * The name of the rights. |
||
55 | * |
||
56 | * @var \Alpha\Model\Type\SmallText |
||
57 | * |
||
58 | * @since 1.0 |
||
59 | */ |
||
60 | protected $name; |
||
61 | |||
62 | /** |
||
63 | * A Relation containing all of the Person objects that have these rights. |
||
64 | * |
||
65 | * @var \Alpha\Model\Type\Relation |
||
66 | * |
||
67 | * @since 1.0 |
||
68 | */ |
||
69 | protected $members; |
||
70 | |||
71 | /** |
||
72 | * An array of data display labels for the class properties. |
||
73 | * |
||
74 | * @var array |
||
75 | * |
||
76 | * @since 1.0 |
||
77 | */ |
||
78 | protected $dataLabels = array('ID' => 'Rights Group ID#', 'name' => 'Rights Group Name', 'members' => 'Rights Group Members'); |
||
79 | |||
80 | /** |
||
81 | * The name of the database table for the class. |
||
82 | * |
||
83 | * @var string |
||
84 | * |
||
85 | * @since 1.0 |
||
86 | */ |
||
87 | const TABLE_NAME = 'Rights'; |
||
88 | |||
89 | /** |
||
90 | * Trace logger. |
||
91 | * |
||
92 | * @var \Alpha\Util\Logging\Logger |
||
93 | * |
||
94 | * @since 1.1 |
||
95 | */ |
||
96 | private static $logger = null; |
||
0 ignored issues
–
show
Comprehensibility
introduced
by
![]() |
|||
97 | |||
98 | /** |
||
99 | * Constructor. |
||
100 | * |
||
101 | * @since 1.0 |
||
102 | */ |
||
103 | public function __construct() |
||
104 | { |
||
105 | self::$logger = new Logger('Rights'); |
||
106 | |||
107 | // ensure to call the parent constructor |
||
108 | parent::__construct(); |
||
109 | $this->name = new SmallText(); |
||
110 | |||
111 | // add unique key to name field |
||
112 | $this->markUnique('name'); |
||
113 | |||
114 | $this->members = new Relation(); |
||
115 | $this->markTransient('members'); |
||
116 | $this->setupRels(); |
||
117 | } |
||
118 | |||
119 | /** |
||
120 | * Get the group members Relation. |
||
121 | * |
||
122 | * @return \Alpha\Model\Type\Relation |
||
123 | * |
||
124 | * @since 1.0 |
||
125 | */ |
||
126 | public function getMembers() |
||
127 | { |
||
128 | return $this->members; |
||
129 | } |
||
130 | |||
131 | /** |
||
132 | * Set up the transient attributes for the rights group after it has loaded. |
||
133 | * |
||
134 | * @since 1.0 |
||
135 | */ |
||
136 | protected function after_load_callback() |
||
137 | { |
||
138 | $this->setupRels(); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * Set up the transient attributes for the rights group after it has been created. |
||
143 | * |
||
144 | * @since 1.2.1 |
||
145 | */ |
||
146 | protected function after_save_callback() |
||
147 | { |
||
148 | $this->setupRels(); |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * Set up the transient attributes for the rights group after it has loaded. |
||
153 | * |
||
154 | * @since 1.0 |
||
155 | */ |
||
156 | protected function after_loadByAttribute_callback() |
||
157 | { |
||
158 | $this->setupRels(); |
||
159 | } |
||
160 | |||
161 | /** |
||
162 | * Sets up the Relation definitions on this record. |
||
163 | * |
||
164 | * @since 1.0 |
||
165 | */ |
||
166 | protected function setupRels() |
||
167 | { |
||
168 | // set up MANY-TO-MANY relation person2rights |
||
169 | $this->members->setRelatedClass('Alpha\Model\Person', 'left'); |
||
170 | $this->members->setRelatedClassDisplayField('email', 'left'); |
||
171 | $this->members->setRelatedClass('Alpha\Model\Rights', 'right'); |
||
172 | $this->members->setRelatedClassDisplayField('name', 'right'); |
||
173 | $this->members->setRelationType('MANY-TO-MANY'); |
||
174 | $this->members->setValue($this->getID()); |
||
175 | } |
||
176 | } |
||
177 |