function &createSingleRealm() { $authenticator = new SimpleAuthenticator(); $authenticator->addRealm(new SimpleUrl('http://www.here.com/path/hello.html'), 'Basic', 'Sanctuary'); $authenticator->setIdentityForRealm('www.here.com', 'Sanctuary', 'test', 'secret'); return $authenticator; }
public function generatePassword($email, &$new_non_crypted_password) { if (!($user_data = $this->getUserByEmail($email))) { return false; } $this->merge($user_data); $new_non_crypted_password = User::generatePassword(); $crypted_password = SimpleAuthenticator::getCryptedPassword($user_data['identifier'], $new_non_crypted_password); $this->set('generated_password', $crypted_password); $this->update(false); return true; }
function testUserInGroupsMethod() { $user = User::instance(); $groups = array(0 => 'visitors', 1 => 'admins'); $user->set('groups', $groups); $this->assertTrue(SimpleAuthenticator::isUserInGroups(array(0 => 'members', 'admins'))); $this->assertFalse(SimpleAuthenticator::isUserInGroups(array(0 => 'members', 'operators'))); $this->assertFalse(SimpleAuthenticator::isUserInGroups(array(0 => 'members'))); $this->assertTrue(SimpleAuthenticator::isUserInGroups(array(0 => 'visitors'))); }
public function isUserInGroups($groups) { if (Limb::toolkit()->getUser()->isLoggedIn() && SimpleAuthenticator::isUserInGroups($groups)) { return true; } }