AppserverIo\Appserver\ServletEngine\Security\Auth\Spi\AbstractLoginModule::commit PHP 메소드

commit() 공개 메소드

It also adds the members of each Group returned by getRoleSets() to the subject getPrincipals() Set.
public commit ( ) : true
리턴 true always.
    public function commit()
    {
        // we can only commit if the login has been successful
        if ($this->loginOk === false) {
            return false;
        }
        // add the identity to the subject's principals
        $principals = $this->subject->getPrincipals();
        $principals->add($this->getIdentity());
        // load the groups
        $roleSets = $this->getRoleSets();
        // iterate over the groups and add them to the subject
        for ($g = 0; $g < sizeof($roleSets); $g++) {
            // initialize group, name and subject group
            $group = $roleSets[$g];
            $name = $group->getName();
            $subjectGroup = $this->createGroup($name, $principals);
            /* if ($subjectGroup instanceof NestableGroup) {
                   // a NestableGroup only allows Groups to be added to it so we need to add a SimpleGroup to subjectRoles to contain the roles
                   $tmp = new SimpleGroup('Roles');
                   $subjectGroup->addMember($tmp);
                   $subjectGroup = $tmp;
               } */
            // copy the group members to the Subject group
            foreach ($group->getMembers() as $member) {
                $subjectGroup->addMember($member);
            }
        }
        // return TRUE if we succeed
        return true;
    }