aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/security
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-05-22 11:02:56 +0200
committerArthurHoaro <arthur@hoa.ro>2020-07-23 21:19:21 +0200
commitaf290059d10319e76d1e7d78b592cab99c26d91a (patch)
treeb088526052182d4b4f3c0af20db89f7d28fc3d9a /application/security
parent893f5159c64e5bcff505c8367e6dc22cc2a7b14d (diff)
downloadShaarli-af290059d10319e76d1e7d78b592cab99c26d91a.tar.gz
Shaarli-af290059d10319e76d1e7d78b592cab99c26d91a.tar.zst
Shaarli-af290059d10319e76d1e7d78b592cab99c26d91a.zip
Process session filters through Slim controllers
Including: - visibility - links per page - untagged only
Diffstat (limited to 'application/security')
-rw-r--r--application/security/SessionManager.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/application/security/SessionManager.php b/application/security/SessionManager.php
index 4ae99168..8b77d362 100644
--- a/application/security/SessionManager.php
+++ b/application/security/SessionManager.php
@@ -8,6 +8,10 @@ use Shaarli\Config\ConfigManager;
8 */ 8 */
9class SessionManager 9class SessionManager
10{ 10{
11 public const KEY_LINKS_PER_PAGE = 'LINKS_PER_PAGE';
12 public const KEY_VISIBILITY = 'visibility';
13 public const KEY_UNTAGGED_ONLY = 'untaggedonly';
14
11 /** @var int Session expiration timeout, in seconds */ 15 /** @var int Session expiration timeout, in seconds */
12 public static $SHORT_TIMEOUT = 3600; // 1 hour 16 public static $SHORT_TIMEOUT = 3600; // 1 hour
13 17
@@ -212,4 +216,33 @@ class SessionManager
212 { 216 {
213 return $this->session[$key] ?? $default; 217 return $this->session[$key] ?? $default;
214 } 218 }
219
220 /**
221 * Store a variable in user session.
222 *
223 * @param string $key Session key
224 * @param mixed $value Session value to store
225 *
226 * @return $this
227 */
228 public function setSessionParameter(string $key, $value): self
229 {
230 $this->session[$key] = $value;
231
232 return $this;
233 }
234
235 /**
236 * Store a variable in user session.
237 *
238 * @param string $key Session key
239 *
240 * @return $this
241 */
242 public function deleteSessionParameter(string $key): self
243 {
244 unset($this->session[$key]);
245
246 return $this;
247 }
215} 248}