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
221
Issues
221
List
Boards
Labels
Service Desk
Milestones
Merge Requests
36
Merge Requests
36
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
Commits
dfc4f306
Commit
dfc4f306
authored
34 minutes ago
by
Brian Hatchet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moderated channel permissions
parent
a110fc61
feat/permissions-on-entities-737
1 merge request
!335
WIP: Feat/permissions on entities 737
Pipeline
#83865256
passed with stages
in 10 minutes and 24 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
2 deletions
+131
-2
ClosedChannelNonSubscriberRole.php
Core/Permissions/Roles/ClosedChannelNonSubscriberRole.php
+1
-0
ClosedChannelSubscriberRole.php
Core/Permissions/Roles/ClosedChannelSubscriberRole.php
+8
-0
ModeratedChannelNonSubscriberRole.php
Core/Permissions/Roles/ModeratedChannelNonSubscriberRole.php
+1
-0
ModeratedChannelSubscriberRole.php
Core/Permissions/Roles/ModeratedChannelSubscriberRole.php
+8
-0
OpenChannelNonSubscriberRole.php
Core/Permissions/Roles/OpenChannelNonSubscriberRole.php
+0
-1
RolesSpec.php
Spec/Core/Permissions/Roles/RolesSpec.php
+113
-1
No files found.
Core/Permissions/Roles/ClosedChannelNonSubscriberRole.php
View file @
dfc4f306
...
...
@@ -7,5 +7,6 @@ class ClosedChannelNonSubscriberRole extends BaseRole
public
function
__construct
()
{
parent
::
__construct
(
Roles
::
ROLE_CLOSED_CHANNEL_NON_SUBSCRIBER
);
//No permissions for closed channel non subscribers
}
}
This diff is collapsed.
Click to expand it.
Core/Permissions/Roles/ClosedChannelSubscriberRole.php
View file @
dfc4f306
...
...
@@ -7,5 +7,13 @@ class ClosedChannelSubscriberRole extends BaseRole
public
function
__construct
()
{
parent
::
__construct
(
Roles
::
ROLE_CLOSED_CHANNEL_SUBSCRIBER
);
$this
->
addPermission
(
Roles
::
FLAG_CREATE_POST
);
$this
->
addPermission
(
Roles
::
FLAG_VIEW
);
$this
->
addPermission
(
Roles
::
FLAG_VOTE
);
$this
->
addPermission
(
Roles
::
FLAG_CREATE_COMMENT
);
$this
->
addPermission
(
Roles
::
FLAG_REMIND
);
$this
->
addPermission
(
Roles
::
FLAG_WIRE
);
$this
->
addPermission
(
Roles
::
FLAG_MESSAGE
);
$this
->
addPermission
(
Roles
::
FLAG_INVITE
);
}
}
This diff is collapsed.
Click to expand it.
Core/Permissions/Roles/ModeratedChannelNonSubscriberRole.php
View file @
dfc4f306
...
...
@@ -7,5 +7,6 @@ class ModeratedChannelNonSubscriberRole extends BaseRole
public
function
__construct
()
{
parent
::
__construct
(
Roles
::
ROLE_MODERATED_CHANNEL_NON_SUBSCRIBER
);
$this
->
addPermission
(
Roles
::
FLAG_VIEW
);
}
}
This diff is collapsed.
Click to expand it.
Core/Permissions/Roles/ModeratedChannelSubscriberRole.php
View file @
dfc4f306
...
...
@@ -7,5 +7,13 @@ class ModeratedChannelSubscriberRole extends BaseRole
public
function
__construct
()
{
parent
::
__construct
(
Roles
::
ROLE_MODERATED_CHANNEL_SUBSCRIBER
);
$this
->
addPermission
(
Roles
::
FLAG_CREATE_POST
);
$this
->
addPermission
(
Roles
::
FLAG_VIEW
);
$this
->
addPermission
(
Roles
::
FLAG_VOTE
);
$this
->
addPermission
(
Roles
::
FLAG_CREATE_COMMENT
);
$this
->
addPermission
(
Roles
::
FLAG_REMIND
);
$this
->
addPermission
(
Roles
::
FLAG_WIRE
);
$this
->
addPermission
(
Roles
::
FLAG_MESSAGE
);
$this
->
addPermission
(
Roles
::
FLAG_INVITE
);
}
}
This diff is collapsed.
Click to expand it.
Core/Permissions/Roles/OpenChannelNonSubscriberRole.php
View file @
dfc4f306
...
...
@@ -7,7 +7,6 @@ class OpenChannelNonSubscriberRole extends BaseRole
public
function
__construct
()
{
parent
::
__construct
(
Roles
::
ROLE_OPEN_CHANNEL_NON_SUBSCRIBER
);
$this
->
addPermission
(
Roles
::
FLAG_CREATE_POST
);
$this
->
addPermission
(
Roles
::
FLAG_SUBSCRIBE
);
$this
->
addPermission
(
Roles
::
FLAG_VIEW
);
$this
->
addPermission
(
Roles
::
FLAG_VOTE
);
...
...
This diff is collapsed.
Click to expand it.
Spec/Core/Permissions/Roles/RolesSpec.php
View file @
dfc4f306
...
...
@@ -101,7 +101,7 @@ class RolesSpec extends ObjectBehavior
{
$role
=
$this
->
getRole
(
Roles
::
ROLE_OPEN_CHANNEL_NON_SUBSCRIBER
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_ADMIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_POST
)
->
shouldEqual
(
tru
e
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_POST
)
->
shouldEqual
(
fals
e
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_CHANNEL
)
->
shouldEqual
(
false
);
...
...
@@ -152,4 +152,116 @@ class RolesSpec extends ObjectBehavior
$role
->
hasPermission
(
Roles
::
FLAG_JOIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN_GATHERING
)
->
shouldEqual
(
false
);
}
public
function
it_should_have_closed_channel_non_subscriber
()
{
$role
=
$this
->
getRole
(
Roles
::
ROLE_CLOSED_CHANNEL_NON_SUBSCRIBER
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_ADMIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_MODERATOR
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_APPROVE_SUBSCRIBER
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_SUBSCRIBE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_VIEW
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_VOTE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_REMIND
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_WIRE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_MESSAGE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_INVITE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN_GATHERING
)
->
shouldEqual
(
false
);
}
public
function
it_should_have_closed_channel_subscriber_permissions
()
{
$role
=
$this
->
getRole
(
Roles
::
ROLE_CLOSED_CHANNEL_SUBSCRIBER
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_ADMIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_POST
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_MODERATOR
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_APPROVE_SUBSCRIBER
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_SUBSCRIBE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_VIEW
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_VOTE
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_COMMENT
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_REMIND
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_WIRE
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_MESSAGE
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_INVITE
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN_GATHERING
)
->
shouldEqual
(
false
);
}
public
function
it_should_have_moderated_channel_non_subscriber_permissions
()
{
$role
=
$this
->
getRole
(
Roles
::
ROLE_MODERATED_CHANNEL_NON_SUBSCRIBER
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_ADMIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_MODERATOR
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_APPROVE_SUBSCRIBER
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_SUBSCRIBE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_VIEW
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_VOTE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_REMIND
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_WIRE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_MESSAGE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_INVITE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN_GATHERING
)
->
shouldEqual
(
false
);
}
public
function
it_should_have_moderated_channel_subscriber_permissions
()
{
$role
=
$this
->
getRole
(
Roles
::
ROLE_MODERATED_CHANNEL_SUBSCRIBER
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_ADMIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_POST
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_CHANNEL
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_POST
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_APPOINT_MODERATOR
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_APPROVE_SUBSCRIBER
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_SUBSCRIBE
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_VIEW
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_VOTE
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_COMMENT
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_COMMENT
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_REMIND
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_WIRE
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_MESSAGE
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_INVITE
)
->
shouldEqual
(
true
);
$role
->
hasPermission
(
Roles
::
FLAG_CREATE_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_EDIT_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_DELETE_GROUP
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN
)
->
shouldEqual
(
false
);
$role
->
hasPermission
(
Roles
::
FLAG_JOIN_GATHERING
)
->
shouldEqual
(
false
);
}
}
This diff is collapsed.
Click to expand it.
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