]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'master' into remove_unused_vars
authorFlorin Peter <github@florin-peter.de>
Tue, 28 May 2013 09:00:49 +0000 (11:00 +0200)
committerFlorin Peter <github@florin-peter.de>
Tue, 28 May 2013 09:00:49 +0000 (11:00 +0200)
Conflicts:
apps/files_encryption/lib/session.php
apps/files_encryption/lib/util.php

1  2 
apps/files_encryption/lib/helper.php
apps/files_encryption/lib/session.php
apps/files_encryption/lib/util.php

Simple merge
index 52dd0b604e9d835c3e7229a0d9c56db2f5bc5b45,1551275c63f5d498ff0db2b06b16f17691d04e30..dbf9a487995f2154d48cee2db476054cb9f4df69
@@@ -104,8 -100,10 +100,10 @@@ class Session 
         * @brief Sets user private key to session
         * @param string $privateKey
         * @return bool
+        *
+        * @note this should only be set on login
         */
 -      public function setPrivateKey( $privateKey ) {
 +      public function setPrivateKey($privateKey) {
  
                $_SESSION['privateKey'] = $privateKey;
  
         *
         */
        public function getPrivateKey() {
 -
+               // return the public share private key if this is a public access
+               if (\OCA\Encryption\Helper::isPublicAccess()) {
+                       return $this->getPublicSharePrivateKey();
+               } else {
+                       if (isset($_SESSION['privateKey']) && !empty($_SESSION['privateKey'])) {
+                               return $_SESSION['privateKey'];
+                       } else {
+                               return false;
+                       }
+               }
+       }
  
-               if (
-                       isset($_SESSION['privateKey'])
-                       && !empty($_SESSION['privateKey'])
-               ) {
+       /**
+        * @brief Sets public user private key to session
+        * @param string $privateKey
+        * @return bool
+        */
+       public function setPublicSharePrivateKey($privateKey) {
  
-                       return $_SESSION['privateKey'];
+               $_SESSION['publicSharePrivateKey'] = $privateKey;
  
-               } else {
+               return true;
  
-                       return false;
+       }
  
+       /**
+        * @brief Gets public share private key from session
+        * @returns string $privateKey
+        *
+        */
+       public function getPublicSharePrivateKey() {
+               if (isset($_SESSION['publicSharePrivateKey']) && !empty($_SESSION['publicSharePrivateKey'])) {
+                       return $_SESSION['publicSharePrivateKey'];
+               } else {
+                       return false;
                }
  
        }
Simple merge