| @@ 195-206 (lines=12) @@ | ||
| 192 | $service->createLDAPUser($this->owner); |
|
| 193 | } |
|
| 194 | ||
| 195 | public function onAfterWrite() |
|
| 196 | { |
|
| 197 | $service = Injector::inst()->get('SilverStripe\\ActiveDirectory\\Services\\LDAPService'); |
|
| 198 | if ( |
|
| 199 | !$service->enabled() || |
|
| 200 | !$this->owner->config()->update_ldap_from_local || |
|
| 201 | !$this->owner->GUID |
|
| 202 | ) { |
|
| 203 | return; |
|
| 204 | } |
|
| 205 | $this->sync(); |
|
| 206 | } |
|
| 207 | ||
| 208 | public function onAfterDelete() |
|
| 209 | { |
|
| @@ 226-236 (lines=11) @@ | ||
| 223 | * Update the local data with LDAP, and ensure local membership is also set in |
|
| 224 | * LDAP too. This writes into LDAP, provided that feature is enabled. |
|
| 225 | */ |
|
| 226 | public function sync() |
|
| 227 | { |
|
| 228 | $service = Injector::inst()->get('SilverStripe\\ActiveDirectory\\Services\\LDAPService'); |
|
| 229 | if ( |
|
| 230 | !$service->enabled() || |
|
| 231 | !$this->owner->GUID |
|
| 232 | ) { |
|
| 233 | return; |
|
| 234 | } |
|
| 235 | $service->updateLDAPFromMember($this->owner); |
|
| 236 | $service->updateLDAPGroupsForMember($this->owner); |
|
| 237 | } |
|
| 238 | ||
| 239 | /** |
|