Skip to content

Commit ba051b6

Browse files
committed
ACL 1.5.0
1 parent 4a4437e commit ba051b6

File tree

7 files changed

+47
-18
lines changed

7 files changed

+47
-18
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Global
2+
.composer
3+
composer.lock
4+
package-lock.json
5+
vendor/
6+
node_modules/
7+
dist/
8+
9+
# Flextype Site Specific
10+
var/
11+
12+
# OS Generated
13+
.DS_Store*
14+
ehthumbs.db
15+
Icon?
16+
Thumbs.db
17+
*.swp
18+
19+
# phpstorm
20+
.idea/*

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
<a name="1.5.0"></a>
2+
# [1.5.0](https://github.com/flextype-plugins/acl) (2020-12-06)
3+
4+
### Features
5+
6+
* **core** update code base for new Flextype 0.9.12
7+
18
<a name="1.4.0"></a>
29
# [1.4.0](https://github.com/flextype-plugins/acl) (2020-08-25)
310

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020 Sergey Romanenko
3+
Copyright (c) 2021 Sergey Romanenko
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

app/Models/Acl.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Flextype\Plugin\Acl\Models;
1313

14-
use Flextype\Component\Session\Session;
14+
1515
use function array_intersect;
1616
use function array_map;
1717
use function explode;
@@ -36,7 +36,7 @@ public function __construct()
3636
*/
3737
public function isUserLoggedIn() : bool
3838
{
39-
if (Session::exists('user_logged_in')) {
39+
if (flextype('session')->has('user_logged_in')) {
4040
return true;
4141
}
4242

@@ -109,7 +109,7 @@ public function isUserLoggedInUuidIn(string $uuids) : bool
109109
*/
110110
public function getUserLoggedInEmail() : string
111111
{
112-
return Session::exists('user_email') ? Session::get('user_email') : '';
112+
return flextype('session')->has('user_email') ? flextype('session')->get('user_email') : '';
113113
}
114114

115115
/**
@@ -121,7 +121,7 @@ public function getUserLoggedInEmail() : string
121121
*/
122122
public function getUserLoggedInRoles() : string
123123
{
124-
return Session::exists('user_roles') ? Session::get('user_roles') : '';
124+
return flextype('session')->has('user_roles') ? flextype('session')->get('user_roles') : '';
125125
}
126126

127127
/**
@@ -133,7 +133,7 @@ public function getUserLoggedInRoles() : string
133133
*/
134134
public function getUserLoggedInUuid() : string
135135
{
136-
return Session::exists('user_uuid') ? Session::get('user_uuid') : '';
136+
return flextype('session')->has('user_uuid') ? flextype('session')->get('user_uuid') : '';
137137
}
138138

139139
/**
@@ -145,7 +145,7 @@ public function getUserLoggedInUuid() : string
145145
*/
146146
public function setUserLoggedIn(bool $logged_in)
147147
{
148-
Session::set('user_logged_in', $logged_in);
148+
flextype('session')->set('user_logged_in', $logged_in);
149149
}
150150

151151
/**
@@ -157,7 +157,7 @@ public function setUserLoggedIn(bool $logged_in)
157157
*/
158158
public function setUserLoggedInUuid(string $uuid)
159159
{
160-
Session::set('user_uuid', $uuid);
160+
flextype('session')->set('user_uuid', $uuid);
161161
}
162162

163163
/**
@@ -169,7 +169,7 @@ public function setUserLoggedInUuid(string $uuid)
169169
*/
170170
public function setUserLoggedInEmail(string $email)
171171
{
172-
Session::set('user_email', $email);
172+
flextype('session')->set('user_email', $email);
173173
}
174174

175175
/**
@@ -181,6 +181,6 @@ public function setUserLoggedInEmail(string $email)
181181
*/
182182
public function setUserLoggedInRoles(string $roles)
183183
{
184-
Session::set('user_roles', $roles);
184+
flextype('session')->set('user_roles', $roles);
185185
}
186186
}

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
},
1818
"require": {
1919
"php": ">=7.3.0",
20-
"ext-json": "*"
20+
"ext-json": "*",
21+
"flextype-components/arrays" : "3.0.1",
22+
"flextype-components/filesystem": "2.0.8"
2123
},
2224
"config": {
2325
"apcu-autoloader": true,

entries_acl.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22

33
namespace Flextype\Plugin\Acl;
44

5-
use Flextype\Component\Session\Session;
5+
66

77
flextype('emitter')->addListener('onEntryAfterInitialized', function() {
88

99
// Get current entry
10-
$entry = flextype('entries')->entry;
10+
$entry = flextype('entries')->getStorage('fetch.data');
1111

1212
// Set ACL rules based on accounts uuids
1313
if (isset($entry['acl']['accounts']['uuids'])) {
1414
if (!flextype('acl')->isUserLoggedInUuidsIn($entry['acl']['accounts']['uuids'])) {
15-
flextype('entries')->entry = [];
15+
flextype('entries')->setStorage('fetch.data', []);
1616
}
1717
}
1818

1919
// Set ACL rules based on accounts emails
2020
if (isset($entry['acl']['accounts']['emails'])) {
2121
if (!flextype('acl')->isUserLoggedInEmailsIn($entry['acl']['accounts']['emails'])) {
22-
flextype('entries')->entry = [];
22+
flextype('entries')->setStorage('fetch.data', []);
2323
}
2424
}
2525

2626
// Set ACL rules based on accounts roles
2727
if (isset($entry['acl']['accounts']['roles'])) {
2828
if (!flextype('acl')->isUserLoggedInRolesIn($entry['acl']['accounts']['roles'])) {
29-
flextype('entries')->entry = [];
29+
flextype('entries')->setStorage('fetch.data', []);
3030
}
3131
}
3232
});

plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: ACL
2-
version: 1.4.0
2+
version: 1.5.0
33
description: ACL plugin for Flextype.
44
icon: fas fa-users-cog
55
author:
@@ -11,5 +11,5 @@ bugs: https://github.com/flextype-plugins/acl/issues
1111
license: MIT
1212

1313
dependencies:
14-
flextype: 0.9.11
14+
flextype: 0.9.12
1515
twig: '>=1.0.0'

0 commit comments

Comments
 (0)