Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (3)
(feat): include permissions in the injected user
· 295c053a
Marcelo Rivera
authored
Oct 02, 2019
295c053a
(fix): Flags.view should be 'view'
· 3dc7d26a
Marcelo Rivera
authored
Oct 02, 2019
3dc7d26a
(fix): enforce view flag
· 8b40f609
Marcelo Rivera
authored
Oct 02, 2019
(fix): show subscription tabs if in requests section
8b40f609
Hide whitespace changes
Inline
Side-by-side
src/app/common/services/permissions/flags.ts
View file @
8b40f609
...
...
@@ -21,6 +21,6 @@ export enum Flags {
SUBSCRIBE
=
'
subscribe
'
,
TAG
=
'
tag
'
,
REMIND
=
'
remind
'
,
VIEW
=
'
wire
'
,
VIEW
=
'
view
'
,
VOTE
=
'
vote
'
,
}
src/app/modules/channels/channel.component.html
View file @
8b40f609
...
...
@@ -50,7 +50,7 @@
<div
class=
"mdl-grid channel-grid m-channel--closed"
style=
"max-width:900px"
*ngIf=
"user && !user.blocked && !user.subscribed &&
user.mode !== 0
"
*ngIf=
"user && !user.blocked && !user.subscribed &&
!canView
"
>
<div
class=
"m-groupSplash__avatar"
>
<minds-avatar
[object]=
"user"
></minds-avatar>
...
...
@@ -87,7 +87,7 @@
<div
class=
"mdl-grid channel-grid"
style=
"max-width:990px"
*ngIf=
"user && !user?.blocked &&
(user.mode === 0 || user.subscribed)
"
*ngIf=
"user && !user?.blocked &&
canView
"
>
<section
class=
"mdl-cell mdl-cell--4-col m-channel-sidebar"
>
<m-channel--sidebar
...
...
@@ -164,7 +164,10 @@
</section>
<!-- Subscriptions list -->
<section
class=
"mdl-cell mdl-cell--8-col"
*ngIf=
"filter == 'subscribers'"
>
<section
class=
"mdl-cell mdl-cell--8-col"
*ngIf=
"filter == 'subscribers' || filter == 'requests'"
>
<div
class=
"mdl-card m-channel--subscribers-tabs"
>
<div
class=
"mdl-tabs__tab-bar"
>
<a
...
...
src/app/modules/channels/channel.component.ts
View file @
8b40f609
...
...
@@ -19,6 +19,7 @@ import { BlockListService } from '../../common/services/block-list.service';
import
{
ChannelSortedComponent
}
from
'
./sorted/sorted.component
'
;
import
{
PermissionsService
}
from
'
../../common/services/permissions/permissions.service
'
;
import
{
ClientMetaService
}
from
'
../../common/services/client-meta.service
'
;
import
{
Flags
}
from
'
../../common/services/permissions/flags
'
;
@
Component
({
moduleId
:
module
.
id
,
...
...
@@ -44,6 +45,10 @@ export class ChannelComponent {
@
ViewChild
(
'
feed
'
,
{
static
:
false
})
private
feed
:
ChannelSortedComponent
;
get
canView
()
{
return
this
.
permissions
.
canInteract
(
this
.
user
,
Flags
.
VIEW
);
}
constructor
(
public
session
:
Session
,
public
client
:
Client
,
...
...
src/index.php
View file @
8b40f609
...
...
@@ -146,10 +146,21 @@
"environment"
=>
getenv
(
'MINDS_ENV'
)
?:
'development'
,
];
if
(
Minds\Core\Session
::
isLoggedIn
()){
$minds
[
'user'
]
=
Minds\Core\Session
::
getLoggedinUser
()
->
export
();
$minds
[
'user'
][
'rewards'
]
=
!!
Minds\Core\Session
::
getLoggedinUser
()
->
getPhoneNumberHash
();
$minds
[
'wallet'
]
=
array
(
'balance'
=>
Minds\Helpers\Counters
::
get
(
Minds\Core\Session
::
getLoggedinUser
()
->
guid
,
'points'
,
false
));
if
(
Minds\Core\Session
::
isLoggedIn
())
{
$user
=
Minds\Core\Session
::
getLoggedinUser
();
$minds
[
'user'
]
=
$user
->
export
();
$minds
[
'user'
][
'rewards'
]
=
!!
Minds\Core\Session
::
getLoggedinUser
()
->
getPhoneNumberHash
();
$minds
[
'wallet'
]
=
array
(
'balance'
=>
Minds\Helpers\Counters
::
get
(
Minds\Core\Session
::
getLoggedinUser
()
->
guid
,
'points'
,
false
));
if
(
Minds\Core\Di\Di
::
_
()
->
get
(
'Features\Manager'
)
->
has
(
'permissions'
))
{
/** @var Minds\Core\Permissions\Manager $permissionsManager */
$permissionsManager
=
Minds\Core\Di\Di
::
_
()
->
get
(
'Permissions\Manager'
);
$permissions
=
$permissionsManager
->
getList
([
'user_guid'
=>
$user
,
'entities'
=>
[
$user
],
]);
$minds
[
'user'
][
'permissions'
]
=
$permissions
->
exportPermission
(
$user
->
getGuid
());
}
}
if
(
__MINDS_CONTEXT__
===
'embed'
)
{
...
...
@@ -158,6 +169,6 @@
?>
window
.
Minds
=
<?=
json_encode
(
$minds
)
?>
;
</script>
</body>
</html>