Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
231
Issues
231
List
Boards
Labels
Service Desk
Milestones
Merge Requests
35
Merge Requests
35
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Compare Revisions
ba9fa58ed3a8bafcf8697164641970cee134519d...5daa3183ea24b23efd11ed1926f18ce583414e35
Source
5daa3183ea24b23efd11ed1926f18ce583414e35
Select Git revision
...
Target
ba9fa58ed3a8bafcf8697164641970cee134519d
Select Git revision
Compare
Commits (2)
(fix): don't include permissions on markers
· 09352203
Marcelo Rivera
authored
5 hours ago
09352203
(fix): correctly inject permissions to exported FeedSyncEntity
· 5daa3183
Marcelo Rivera
authored
5 hours ago
5daa3183
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
12 deletions
+31
-12
Exportable.php
Api/Exportable.php
+19
-3
Factory.php
Api/Factory.php
+7
-5
markers.php
Controllers/api/v2/notifications/markers.php
+1
-1
FeedSyncEntity.php
Core/Feeds/FeedSyncEntity.php
+3
-2
Manager.php
Core/Permissions/Manager.php
+1
-1
No files found.
Api/Exportable.php
View file @
5daa3183
...
...
@@ -9,6 +9,8 @@
namespace
Minds\Api
;
use
Minds\Core\Di\Di
;
use
Minds\Core\Feeds\FeedSyncEntity
;
use
Minds\Core\Permissions\Manager
;
use
Minds\Core\Session
;
class
Exportable
implements
\JsonSerializable
...
...
@@ -104,10 +106,24 @@ class Exportable implements \JsonSerializable
$exported
=
$item
->
export
(
...
$this
->
exportArgs
);
if
(
$item
&&
Di
::
_
()
->
get
(
'Features\Manager'
)
->
has
(
'permissions'
))
{
if
(
$item
instanceof
FeedSyncEntity
&&
$item
->
getEntity
())
{
$entity
=
$item
->
getEntity
();
}
else
{
$entity
=
$item
;
}
/** @var Manager $permissionsManager */
$permissionsManager
=
Di
::
_
()
->
get
(
'Permissions\Manager'
);
$permissions
=
$permissionsManager
->
getList
([
'user_guid'
=>
Session
::
getLoggedinUser
(),
'entities'
=>
[
$item
]]);
$exported
[
'permissions'
]
=
$permissions
->
export
();
$permissions
=
$permissionsManager
->
getList
([
'user_guid'
=>
Session
::
getLoggedinUser
(),
'entities'
=>
[
$entity
],
]);
if
(
$item
instanceof
FeedSyncEntity
)
{
$exported
[
'entity'
][
'permissions'
]
=
$permissions
->
export
();
}
else
{
$exported
[
'permissions'
]
=
$permissions
->
export
();
}
}
// Shims
...
...
This diff is collapsed.
Click to expand it.
Api/Factory.php
View file @
5daa3183
...
...
@@ -209,13 +209,13 @@ class Factory
* @return array - an array of the entities
* @deprecated
*/
public
static
function
exportable
(
$entities
,
$exceptions
=
[],
$exportContext
=
false
)
public
static
function
exportable
(
$entities
,
$exceptions
=
[],
$exportContext
=
false
,
$includePermissions
=
true
)
{
$permissionsManager
=
Di
::
_
()
->
get
(
'Permissions\Manager'
);
if
(
!
$entities
)
{
return
[];
}
foreach
(
$entities
as
$k
=>
$entity
)
{
if
(
$exportContext
&&
method_exists
(
$entity
,
'setExportContext'
))
{
$entity
->
setExportContext
(
$exportContext
);
...
...
@@ -223,9 +223,11 @@ class Factory
$entities
[
$k
]
=
$entity
->
export
();
//Calculate new permissions object with the entities
if
(
$entity
&&
Di
::
_
()
->
get
(
'Features\Manager'
)
->
has
(
'permissions'
))
{
$permissions
=
$permissionsManager
->
getList
([
'user_guid'
=>
Session
::
getLoggedinUser
(),
'entities'
=>
[
$entity
]]);
if
(
$includePermissions
&&
$entity
&&
Di
::
_
()
->
get
(
'Features\Manager'
)
->
has
(
'permissions'
))
{
$permissions
=
$permissionsManager
->
getList
([
'user_guid'
=>
Session
::
getLoggedinUser
(),
'entities'
=>
[
$entity
],
]);
$entities
[
$k
][
'permissions'
]
=
$permissions
->
export
();
}
$entities
[
$k
][
'guid'
]
=
(
string
)
$entities
[
$k
][
'guid'
];
//javascript doesn't like long numbers..
...
...
This diff is collapsed.
Click to expand it.
Controllers/api/v2/notifications/markers.php
View file @
5daa3183
...
...
@@ -41,7 +41,7 @@ class markers implements Interfaces\Api
return
Factory
::
response
([
'markers'
=>
Factory
::
exportable
(
$list
),
'markers'
=>
Factory
::
exportable
(
$list
,
[],
false
,
true
),
]);
}
...
...
This diff is collapsed.
Click to expand it.
Core/Feeds/FeedSyncEntity.php
View file @
5daa3183
...
...
@@ -8,7 +8,7 @@
namespace
Minds\Core\Feeds
;
use
JsonSerializable
;
use
Minds\
Traits\Exportable
;
use
Minds\
Entities\Entity
;
use
Minds\Traits\MagicAttributes
;
/**
...
...
@@ -26,6 +26,7 @@ use Minds\Traits\MagicAttributes;
* @method FeedSyncEntity setAccessId(int $accessId)
* @method string getType()
* @method FeedSyncEntity setType(string $type)
* @method Entity getEntity()
*/
class
FeedSyncEntity
implements
JsonSerializable
{
...
...
@@ -68,7 +69,7 @@ class FeedSyncEntity implements JsonSerializable
{
return
[
'guid'
=>
(
string
)
$this
->
guid
,
'owner_guid'
=>
(
string
)
$this
->
ownerGuid
,
'owner_guid'
=>
(
string
)
$this
->
ownerGuid
,
'access_id'
=>
$this
->
accessId
,
'timestamp'
=>
$this
->
timestamp
,
'urn'
=>
$this
->
urn
,
...
...
This diff is collapsed.
Click to expand it.
Core/Permissions/Manager.php
View file @
5daa3183
...
...
@@ -45,7 +45,7 @@ class Manager
}
$guids
=
$opts
[
'guids'
]
?:
array_map
(
function
(
$item
)
{
return
$item
[
'guid'
]
;
return
$item
->
getGuid
()
;
},
$opts
[
'entities'
]);
$user
=
$this
->
entitiesBuilder
->
single
(
$opts
[
'user_guid'
]);
...
...
This diff is collapsed.
Click to expand it.