@@ 90-100 (lines=11) @@ | ||
87 | { |
|
88 | /** @var Group $group */ |
|
89 | $group = $this->Groups->get($id, ['contain' => []]); |
|
90 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
91 | $group = $this->Groups->patchEntity($group, $this->request->getData()); |
|
92 | if ($result = $this->Groups->save($group)) { |
|
93 | $this->Flash->success(__d('community', 'The group has been updated.')); |
|
94 | return $this->App->redirect([ |
|
95 | 'apply' => ['action' => 'edit', $result->id] |
|
96 | ]); |
|
97 | } else { |
|
98 | $this->Flash->error(__d('community', 'The group could not be updated. Please, try again.')); |
|
99 | } |
|
100 | } |
|
101 | ||
102 | $parents = $this->Groups->getTreeList(); |
|
103 | $this->set(compact('group', 'parents')); |
@@ 85-93 (lines=9) @@ | ||
82 | $user = $this->Users->get($id, ['contain' => []]); |
|
83 | $user->set('password', null); |
|
84 | ||
85 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
86 | $user = $this->Users->patchEntity($user, $this->request->getData()); |
|
87 | if ($result = $this->Users->save($user)) { |
|
88 | $this->Flash->success(__d('community', 'Password has been updated.')); |
|
89 | return $this->App->redirect(['apply' => ['action' => 'edit', $result->id]]); |
|
90 | } else { |
|
91 | $this->Flash->error(__d('community', 'Password could not be updated. Please, try again.')); |
|
92 | } |
|
93 | } |
|
94 | ||
95 | $this |
|
96 | ->set(compact('user')) |
|
@@ 116-129 (lines=14) @@ | ||
113 | $user = $this->Users->get($id); |
|
114 | $groups = $this->Users->Groups->getTreeList(); |
|
115 | ||
116 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
117 | $user = $this->Users->patchEntity($user, $this->request->getData()); |
|
118 | if ($result = $this->Users->save($user)) { |
|
119 | $this->Flash->success(__d('community', 'The user {0} has been saved.', sprintf( |
|
120 | '<strong>«%s»</strong>', |
|
121 | $result->get('login') |
|
122 | ))); |
|
123 | return $this->App->redirect([ |
|
124 | 'apply' => ['action' => 'edit', $result->id] |
|
125 | ]); |
|
126 | } else { |
|
127 | $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); |
|
128 | } |
|
129 | } |
|
130 | ||
131 | $this |
|
132 | ->set(compact('user', 'groups')) |