Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
702
Issues
702
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
60
Merge Requests
60
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
5d0f59e1
Commit
5d0f59e1
authored
Oct 07, 2019
by
Marcelo Rivera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): enforce view permission flag
parent
15e39046
Pipeline
#87074647
failed with stages
in 6 minutes and 33 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
5 deletions
+35
-5
src/app/modules/blogs/view/infinite.ts
src/app/modules/blogs/view/infinite.ts
+12
-2
src/app/modules/media/view/view.component.ts
src/app/modules/media/view/view.component.ts
+13
-3
src/app/modules/newsfeed/single/single.component.ts
src/app/modules/newsfeed/single/single.component.ts
+10
-0
No files found.
src/app/modules/blogs/view/infinite.ts
View file @
5d0f59e1
...
...
@@ -10,6 +10,9 @@ import { AnalyticsService } from '../../../services/analytics';
import
{
MindsBlogResponse
}
from
'
../../../interfaces/responses
'
;
import
{
MindsBlogEntity
}
from
'
../../../interfaces/entities
'
;
import
{
Flags
}
from
'
../../../common/services/permissions/flags
'
;
import
{
FeaturesService
}
from
'
../../../services/features.service
'
;
import
{
PermissionsService
}
from
'
../../../common/services/permissions/permissions.service
'
;
@
Component
({
moduleId
:
module
.
id
,
...
...
@@ -37,7 +40,9 @@ export class BlogViewInfinite {
public
title
:
MindsTitle
,
private
applicationRef
:
ApplicationRef
,
private
cd
:
ChangeDetectorRef
,
private
analytics
:
AnalyticsService
private
analytics
:
AnalyticsService
,
private
featuresService
:
FeaturesService
,
private
permissionsService
:
PermissionsService
)
{}
ngOnInit
()
{
...
...
@@ -96,7 +101,12 @@ export class BlogViewInfinite {
},
response
.
blog
.
guid
);
}
else
if
(
this
.
blogs
.
length
===
0
)
{
}
else
if
(
this
.
blogs
.
length
===
0
||
(
this
.
featuresService
.
has
(
'
permissions
'
)
&&
!
this
.
permissionsService
.
canInteract
(
this
.
blogs
[
0
],
Flags
.
VIEW
))
)
{
this
.
blogs
=
[];
this
.
error
=
"
Sorry, we couldn't load the blog
"
;
}
//hack: ios rerun on low memory
...
...
src/app/modules/media/view/view.component.ts
View file @
5d0f59e1
import
{
ChangeDetectorRef
,
Component
,
OnInit
,
Injector
,
OnDestroy
,
OnInit
,
SkipSelf
,
Injector
,
}
from
'
@angular/core
'
;
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
...
...
@@ -18,8 +18,10 @@ import { AttachmentService } from '../../../services/attachment';
import
{
ContextService
}
from
'
../../../services/context.service
'
;
import
{
MindsTitle
}
from
'
../../../services/ux/title
'
;
import
{
ActivityService
}
from
'
../../../common/services/activity.service
'
;
import
{
AnalyticsService
}
from
'
../../../services/analytics
'
;
import
{
ClientMetaService
}
from
'
../../../common/services/client-meta.service
'
;
import
{
FeaturesService
}
from
'
../../../services/features.service
'
;
import
{
PermissionsService
}
from
'
../../../common/services/permissions/permissions.service
'
;
import
{
Flags
}
from
'
../../../common/services/permissions/flags
'
;
@
Component
({
moduleId
:
module
.
id
,
...
...
@@ -75,6 +77,8 @@ export class MediaViewComponent implements OnInit, OnDestroy {
private
cd
:
ChangeDetectorRef
,
protected
activityService
:
ActivityService
,
private
clientMetaService
:
ClientMetaService
,
private
featuresService
:
FeaturesService
,
private
permissionsService
:
PermissionsService
,
@
SkipSelf
()
injector
:
Injector
)
{
this
.
clientMetaService
...
...
@@ -122,6 +126,12 @@ export class MediaViewComponent implements OnInit, OnDestroy {
return
;
}
if
(
response
.
entity
)
{
if
(
this
.
featuresService
.
has
(
'
permissions
'
)
&&
!
this
.
permissionsService
.
canInteract
(
response
.
entity
,
Flags
.
VIEW
)
)
{
throw
new
Error
(
'
Insufficient permissions
'
);
}
this
.
entity
=
response
.
entity
;
this
.
allowComments
=
this
.
entity
[
'
allow_comments
'
];
switch
(
this
.
entity
.
subtype
)
{
...
...
src/app/modules/newsfeed/single/single.component.ts
View file @
5d0f59e1
...
...
@@ -10,6 +10,8 @@ import { EntitiesService } from '../../../common/services/entities.service';
import
{
Client
}
from
'
../../../services/api/client
'
;
import
{
FeaturesService
}
from
'
../../../services/features.service
'
;
import
{
ClientMetaService
}
from
'
../../../common/services/client-meta.service
'
;
import
{
PermissionsService
}
from
'
../../../common/services/permissions/permissions.service
'
;
import
{
Flags
}
from
'
../../../common/services/permissions/flags
'
;
@
Component
({
selector
:
'
m-newsfeed--single
'
,
...
...
@@ -33,6 +35,7 @@ export class NewsfeedSingleComponent {
public
entitiesService
:
EntitiesService
,
protected
client
:
Client
,
protected
featuresService
:
FeaturesService
,
protected
permissionsService
:
PermissionsService
,
protected
clientMetaService
:
ClientMetaService
,
@
SkipSelf
()
injector
:
Injector
)
{
...
...
@@ -80,6 +83,13 @@ export class NewsfeedSingleComponent {
if
(
activity
===
null
)
{
return
;
// Not yet loaded
}
if
(
this
.
featuresService
.
has
(
'
permissions
'
)
&&
!
this
.
permissionsService
.
canInteract
(
activity
,
Flags
.
VIEW
)
)
{
this
.
error
=
"
Sorry, we couldn't load the activity
"
;
return
;
}
this
.
activity
=
activity
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment