Skip to content

Commit

Permalink
Merge pull request #44 from sourceplusplus/dev
Browse files Browse the repository at this point in the history
v0.4.3
  • Loading branch information
BFergerson authored Mar 19, 2022
2 parents cad607f + 9309ba2 commit e568129
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 40 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kotlin.code.style=official

projectVersion=0.4.2
projectVersion=0.4.3

kotlinVersion=1.6.10
vertxVersion=4.2.4
Expand Down
24 changes: 24 additions & 0 deletions src/commonMain/kotlin/spp.protocol/platform/auth/CommandType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Source++, the open-source live coding platform.
* Copyright (C) 2022 CodeBrig, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package spp.protocol.platform.auth

enum class CommandType {
LIVE_SERVICE,
LIVE_VIEW,
LIVE_INSTRUMENT
}
83 changes: 44 additions & 39 deletions src/commonMain/kotlin/spp.protocol/platform/auth/RolePermission.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,62 @@
*/
package spp.protocol.platform.auth

enum class RolePermission(val manager: Boolean = true) {
RESET(true),
import spp.protocol.platform.auth.CommandType.*

enum class RolePermission(val manager: Boolean, val commandType: CommandType) {
RESET(true, LIVE_SERVICE),

//devs
ADD_DEVELOPER(true),
REMOVE_DEVELOPER(true),
GET_DEVELOPERS(true),
REFRESH_DEVELOPER_TOKEN(true),
ADD_DEVELOPER(true, LIVE_SERVICE),
REMOVE_DEVELOPER(true, LIVE_SERVICE),
GET_DEVELOPERS(true, LIVE_SERVICE),
REFRESH_DEVELOPER_TOKEN(true, LIVE_SERVICE),

//roles
ADD_ROLE(true),
REMOVE_ROLE(true),
GET_ROLES(true),
GET_DEVELOPER_ROLES(true),
ADD_DEVELOPER_ROLE(true),
REMOVE_DEVELOPER_ROLE(true),
ADD_ROLE(true, LIVE_SERVICE),
REMOVE_ROLE(true, LIVE_SERVICE),
GET_ROLES(true, LIVE_SERVICE),
GET_DEVELOPER_ROLES(true, LIVE_SERVICE),
ADD_DEVELOPER_ROLE(true, LIVE_SERVICE),
REMOVE_DEVELOPER_ROLE(true, LIVE_SERVICE),

//permissions
GET_DEVELOPER_PERMISSIONS(true),
GET_ROLE_PERMISSIONS(true),
ADD_ROLE_PERMISSION(true),
REMOVE_ROLE_PERMISSION(true),
GET_DEVELOPER_PERMISSIONS(true, LIVE_SERVICE),
GET_ROLE_PERMISSIONS(true, LIVE_SERVICE),
ADD_ROLE_PERMISSION(true, LIVE_SERVICE),
REMOVE_ROLE_PERMISSION(true, LIVE_SERVICE),

//instrument access
GET_ACCESS_PERMISSIONS(true),
GET_DATA_REDACTIONS(true),
ADD_DATA_REDACTION(true),
REMOVE_DATA_REDACTION(true),
ADD_ACCESS_PERMISSION(true),
REMOVE_ACCESS_PERMISSION(true),
GET_ACCESS_PERMISSIONS(true, LIVE_SERVICE),
GET_DATA_REDACTIONS(true, LIVE_SERVICE),
ADD_DATA_REDACTION(true, LIVE_SERVICE),
REMOVE_DATA_REDACTION(true, LIVE_SERVICE),
ADD_ACCESS_PERMISSION(true, LIVE_SERVICE),
REMOVE_ACCESS_PERMISSION(true, LIVE_SERVICE),

//instruments
ADD_LIVE_BREAKPOINT(false),
ADD_LIVE_LOG(false),
ADD_LIVE_METER(false),
ADD_LIVE_SPAN(false),
GET_LIVE_INSTRUMENTS(false),
GET_LIVE_BREAKPOINTS(false),
GET_LIVE_LOGS(false),
GET_LIVE_METERS(false),
GET_LIVE_SPANS(false),
REMOVE_LIVE_INSTRUMENT(false),
CLEAR_ALL_LIVE_INSTRUMENTS(false),
ADD_LIVE_BREAKPOINT(false, LIVE_INSTRUMENT),
ADD_LIVE_LOG(false, LIVE_INSTRUMENT),
ADD_LIVE_METER(false, LIVE_INSTRUMENT),
ADD_LIVE_SPAN(false, LIVE_INSTRUMENT),
GET_LIVE_INSTRUMENTS(false, LIVE_INSTRUMENT),
GET_LIVE_BREAKPOINTS(false, LIVE_INSTRUMENT),
GET_LIVE_LOGS(false, LIVE_INSTRUMENT),
GET_LIVE_METERS(false, LIVE_INSTRUMENT),
GET_LIVE_SPANS(false, LIVE_INSTRUMENT),
REMOVE_LIVE_INSTRUMENT(false, LIVE_INSTRUMENT),
CLEAR_ALL_LIVE_INSTRUMENTS(false, LIVE_INSTRUMENT),

//views
ADD_LIVE_VIEW_SUBSCRIPTION(false),
REMOVE_LIVE_VIEW_SUBSCRIPTION(false),
GET_LIVE_VIEW_SUBSCRIPTIONS(false),
VIEW_ACTIVITY(false),
VIEW_TRACES(false),
VIEW_LOGS(false);
ADD_LIVE_VIEW_SUBSCRIPTION(false, LIVE_VIEW),
REMOVE_LIVE_VIEW_SUBSCRIPTION(false, LIVE_VIEW),
GET_LIVE_VIEW_SUBSCRIPTIONS(false, LIVE_VIEW),

// VIEW_OVERVIEW(false, LIVE_VIEW),
VIEW_ACTIVITY(false, LIVE_VIEW),
VIEW_TRACES(false, LIVE_VIEW),
VIEW_LOGS(false, LIVE_VIEW),
SHOW_QUICK_STATS(false, LIVE_VIEW);

companion object {
fun fromString(s: String): RolePermission? {
Expand Down

0 comments on commit e568129

Please sign in to comment.