@@ -232,7 +232,7 @@ |
||
232 | 232 | |
233 | 233 | /** |
234 | 234 | * Business logic around displaying an appropriate feedback message to the user regbarding the change. |
235 | - * @param $model |
|
235 | + * @param ConfirmationRequest $model |
|
236 | 236 | */ |
237 | 237 | protected function displayMessage($model) { |
238 | 238 | Yii::$app->session->setFlash('warning', 'Your update is pending confirmation. Please check your email for a confirmation link.'); |
@@ -128,15 +128,17 @@ discard block |
||
128 | 128 | protected function isAuthorised($user, $attribute, $value) { |
129 | 129 | |
130 | 130 | //Check for pre-defined administration roles |
131 | - if ($this->userIsAuthorised($user)) |
|
132 | - return true; |
|
131 | + if ($this->userIsAuthorised($user)) { |
|
132 | + return true; |
|
133 | + } |
|
133 | 134 | |
134 | 135 | //Check for valid release token , eg that the token exists and is for the same record as this |
135 | 136 | if ($this->releaseToken != null) { |
136 | 137 | $confirmation = ConfirmationRequest::findOne(['release_token' => $this->releaseToken]); |
137 | 138 | |
138 | - if ($confirmation == null) |
|
139 | - return false; |
|
139 | + if ($confirmation == null) { |
|
140 | + return false; |
|
141 | + } |
|
140 | 142 | |
141 | 143 | $model = $confirmation->constructObject(); |
142 | 144 | |
@@ -145,9 +147,10 @@ discard block |
||
145 | 147 | } |
146 | 148 | |
147 | 149 | //Check to see if any protected attributes have been altered |
148 | - foreach ($this->protectedAttributes as $attribute) |
|
149 | - if ($this->hasChanged($attribute)) |
|
150 | + foreach ($this->protectedAttributes as $attribute) { |
|
151 | + if ($this->hasChanged($attribute)) |
|
150 | 152 | return false; |
153 | + } |
|
151 | 154 | |
152 | 155 | return true; |
153 | 156 | } |
@@ -159,9 +162,10 @@ discard block |
||
159 | 162 | * @return bool |
160 | 163 | */ |
161 | 164 | protected function userIsAuthorised($user) { |
162 | - foreach ($this->allow as $role) |
|
163 | - if ($user->can($role)) |
|
165 | + foreach ($this->allow as $role) { |
|
166 | + if ($user->can($role)) |
|
164 | 167 | return true; |
168 | + } |
|
165 | 169 | |
166 | 170 | return false; |
167 | 171 | } |
@@ -205,9 +209,10 @@ discard block |
||
205 | 209 | public function getChangedValues() { |
206 | 210 | $changedAttributes = []; |
207 | 211 | |
208 | - foreach ($this->owner->attributes() as $attribute) |
|
209 | - if ($this->hasChanged($attribute)) |
|
212 | + foreach ($this->owner->attributes() as $attribute) { |
|
213 | + if ($this->hasChanged($attribute)) |
|
210 | 214 | $changedAttributes[$attribute] = $this->owner->$attribute; |
215 | + } |
|
211 | 216 | |
212 | 217 | unset($changedAttributes[$this->timestampAttribute]); |
213 | 218 |