src/snac/server/ServerExecutor.php
/**
     * Unlock Constellation
     *
     * Lowers the lock on a constellation from "currently editing" to "locked editing."  The constellation
     * must be given in the input.
     *
     * @param string[] $input Input array from the Server object
     * @throws \snac\exceptions\SNACException
     * @return string[] The response to send to the client
     */
Unlock Constellation
Lowers the lock on a constellation from "currently editing" to "locked editing."  The constellation
must be given in the input.

@param string[] $input Input array from the Server object
@throws \snac\exceptions\SNACException
@return string[] The response to send to the client
Unlock Constellation Lowers the lock on a constellation from " currently editing " to " locked editing . " The constellation must be given in the input . @param string [] $input Input array from the Server object @throws \ snac \ exceptions \ SNACException @return string [] The response to send to the client
public function unlockConstellation(&$input) {
        $response = array();
        try {
            $this->logger->addDebug("Lowering the lock on the constellation");
            if (isset($input["constellation"])) {
                $constellation = new \snac\data\Constellation($input["constellation"]);
                $currentStatus = $this->cStore->readConstellationStatus($constellation->getID());
                $current = $this->cStore->readConstellation($constellation->getID(), null, DBUtil::$READ_NRD);
                $info = $this->cStore->readConstellationUserStatus($constellation->getID());
                $inList = false;
                if ($info != null && $this->user->getUserID() == $info["userid"] &&
                        ($info["status"] == "currently editing" || $info["status"] == "needs review")) {
                    $inList = true;
                }
                if ($current->getVersion() == $constellation->getVersion() && ($inList || $this->hasPermission("Change Locks"))) {
                    $result = false;
                    if ($this->cStore->readConstellationStatus($constellation->getID(), -1) === "published") {
                        $this->logger->addDebug("re-publishing to unlock constellation");
                        $result = $this->cStore->writeConstellationStatus($this->user, $constellation->getID(),
                                        "published", "Republish: User canceled edit without making changes");
                        $this->updateIndexesAfterPublish($constellation->getID());
                    } else {
                        $result = $this->cStore->writeConstellationStatus($this->user, $constellation->getID(),
                                        "locked editing", "User finished editing constellation");
                    }
                    if (isset($result) && $result !== false) {
                        $this->logger->addDebug("successfully unlocked constellation");
                        $constellation->setVersion($result);
                        $response["constellation"] = $constellation->toArray();
                        $response["result"] = "success";
                    } else {
                        $this->logger->addDebug("could not unlock the constellation");
                        $response["result"] = "failure";
                        $response["error"] = "writing status failed";
                    }
                } else {
                    $this->logger->addDebug("constellation versions didn't match or was not in users currently editing list");
                    $response["result"] = "failure";
                    $response["error"] = "other changes have been made to this constellation";
                    $response["constellation"] = $constellation->toArray();
                }
            } else {
                $this->logger->addDebug("no constellation given to unlock");
                $response["result"] = "failure";
                $response["error"] = "no constellation given";
            }
        } catch (\Exception $e) {
            $this->logger->addError("unlocking constellation threw an exception");
            $response["result"] = "failure";
            throw $e;
        }
        return $response;
    }
public function unlockConstellation ( & $ input ) { $ response = array ( ) ; try { $ this -> logger -> addDebug ( " Lowering the lock on the constellation " ) ; if ( isset ( $ input [ " constellation " ] ) ) { $ constellation = new \ snac \ data \ Constellation ( $ input [ " constellation " ] ) ; $ currentStatus = $ this -> cStore -> readConstellationStatus ( $ constellation -> getID ( ) ) ; $ current = $ this -> cStore -> readConstellation ( $ constellation -> getID ( ) , null , DBUtil :: $ READ_NRD ) ; $ info = $ this -> cStore -> readConstellationUserStatus ( $ constellation -> getID ( ) ) ; $ inList = false ; if ( $ info != null && $ this -> user -> getUserID ( ) == $ info [ " userid " ] && ( $ info [ " status " ] == " currently editing " || $ info [ " status " ] == " needs review " ) ) { $ inList = true ; } if ( $ current -> getVersion ( ) == $ constellation -> getVersion ( ) && ( $ inList || $ this -> hasPermission ( " Change Locks " ) ) ) { $ result = false ; if ( $ this -> cStore -> readConstellationStatus ( $ constellation -> getID ( ) , - 1 ) === " published " ) { $ this -> logger -> addDebug ( " re-publishing to unlock constellation " ) ; $ result = $ this -> cStore -> writeConstellationStatus ( $ this -> user , $ constellation -> getID ( ) , " published " , " Republish: User canceled edit without making changes " ) ; $ this -> updateIndexesAfterPublish ( $ constellation -> getID ( ) ) ; } else { $ result = $ this -> cStore -> writeConstellationStatus ( $ this -> user , $ constellation -> getID ( ) , " locked editing " , " User finished editing constellation " ) ; } if ( isset ( $ result ) && $ result !== false ) { $ this -> logger -> addDebug ( " successfully unlocked constellation " ) ; $ constellation -> setVersion ( $ result ) ; $ response [ " constellation " ] = $ constellation -> toArray ( ) ; $ response [ " result " ] = " success " ; } else { $ this -> logger -> addDebug ( " could not unlock the constellation " ) ; $ response [ " result " ] = " failure " ; $ response [ " error " ] = " writing status failed " ; } } else { $ this -> logger -> addDebug ( " constellation versions didn't match or was not in users currently editing list " ) ; $ response [ " result " ] = " failure " ; $ response [ " error " ] = " other changes have been made to this constellation " ; $ response [ " constellation " ] = $ constellation -> toArray ( ) ; } } else { $ this -> logger -> addDebug ( " no constellation given to unlock " ) ; $ response [ " result " ] = " failure " ; $ response [ " error " ] = " no constellation given " ; } } catch ( \ Exception $ e ) { $ this -> logger -> addError ( " unlocking constellation threw an exception " ) ; $ response [ " result " ] = " failure " ; throw $ e ; } return $ response ; }
Unlock Constellation
 Lowers the lock on a constellation from "currently editing" to "locked editing."
Unlock Constellation Lowers the lock on a constellation from " currently editing " to " locked editing . "
// Read the summary out of the database. if the version numbers match AND the constellation // is currently editing for the user, THEN unlock it.  Else, send back a note to the client with a failure // Read the current summary // If this constellation is in the list of currently editing for the user OR the user has change locks permission, then unlock it