Last active
August 29, 2015 13:57
-
-
Save stevommmm/9519118 to your computer and use it in GitHub Desktop.
Remove ability to set passwords via authentication backends in OwnCloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (version_compare(PHP_VERSION, '5.3.0') >= 0) { | |
| $myClassReflection = new ReflectionClass(get_class(OC::$server->getUserManager())); | |
| $secret = $myClassReflection->getProperty('backends'); | |
| $secret->setAccessible(true); | |
| foreach($secret->getValue(OC::$server->getUserManager()) as $bkend) { | |
| // var_dump($bkend); | |
| $lclrefclass = new ReflectionClass($bkend); | |
| $s = $lclrefclass->getProperty('possibleActions'); | |
| $s->setAccessible(true); | |
| $pactions = $s->getValue($bkend); | |
| if(($key = array_search('setPassword', $pactions)) !== false) { | |
| unset($pactions[$key]); | |
| } | |
| OC_LOG::write('oc_otp', 'Backend password change before: ' . $bkend->implementsActions(OC_USER_BACKEND_SET_PASSWORD) ? 'enabled' : 'disabled', OC_Log::DEBUG); | |
| $s->setValue($bkend, $pactions); | |
| OC_LOG::write('oc_otp', 'Backend password change after: ' . $bkend->implementsActions(OC_USER_BACKEND_SET_PASSWORD) ? 'enabled' : 'disabled', OC_Log::DEBUG); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment