-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init Role, RoleInstancePermission and RoleClassPermission
- Loading branch information
Showing
27 changed files
with
1,886 additions
and
23 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
shogun-boot/src/main/resources/db/migration/V0.14.0__Init_Role.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
CREATE TABLE IF NOT EXISTS shogun.roles ( | ||
id BIGINT PRIMARY KEY, | ||
created TIMESTAMP WITHOUT TIME ZONE, | ||
modified TIMESTAMP WITHOUT TIME ZONE, | ||
auth_provider_id TEXT UNIQUE NOT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS shogun.roleclasspermissions ( | ||
id BIGINT PRIMARY KEY, | ||
created TIMESTAMP WITHOUT TIME ZONE, | ||
modified TIMESTAMP WITHOUT TIME ZONE, | ||
class_name TEXT, | ||
permission_id BIGINT NOT NULL REFERENCES permissions (id), | ||
role_id BIGINT NOT NULL REFERENCES roles (id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS shogun.roleinstancepermissions ( | ||
id BIGINT PRIMARY KEY, | ||
created TIMESTAMP WITHOUT TIME ZONE, | ||
modified TIMESTAMP WITHOUT TIME ZONE, | ||
entity_id bigint NOT NULL, | ||
permission_id bigint NOT NULL REFERENCES permissions (id), | ||
role_id BIGINT NOT NULL REFERENCES roles (id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS shogun_rev.roles_rev ( | ||
id BIGINT, | ||
rev INTEGER REFERENCES shogun_rev.revinfo (rev), | ||
revtype SMALLINT, | ||
created TIMESTAMP WITHOUT TIME ZONE, | ||
modified TIMESTAMP WITHOUT TIME ZONE, | ||
auth_provider_id TEXT, | ||
created_mod BOOLEAN, | ||
modified_mod BOOLEAN, | ||
auth_provider_id_mod BOOLEAN, | ||
PRIMARY KEY (id, rev) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS shogun_rev.roleclasspermissions_rev ( | ||
id BIGINT, | ||
rev INTEGER REFERENCES shogun_rev.revinfo (rev), | ||
revtype SMALLINT, | ||
created TIMESTAMP WITHOUT TIME ZONE, | ||
modified TIMESTAMP WITHOUT TIME ZONE, | ||
class_name TEXT, | ||
permission_id BIGINT, | ||
role_id BIGINT, | ||
created_mod BOOLEAN, | ||
modified_mod BOOLEAN, | ||
class_name_mod BOOLEAN, | ||
permission_id_mod BOOLEAN, | ||
permission_mod BOOLEAN, | ||
role_id_mod BOOLEAN, | ||
role_mod BOOLEAN, | ||
PRIMARY KEY (id, rev) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS shogun_rev.roleinstancepermissions_rev ( | ||
id BIGINT, | ||
rev INTEGER REFERENCES shogun_rev.revinfo (rev), | ||
revtype SMALLINT, | ||
created TIMESTAMP WITHOUT TIME ZONE, | ||
modified TIMESTAMP WITHOUT TIME ZONE, | ||
entity_id BIGINT, | ||
permission_id BIGINT, | ||
role_id bigint, | ||
created_mod BOOLEAN, | ||
modified_mod BOOLEAN, | ||
entity_id_mod BOOLEAN, | ||
permission_id_mod BOOLEAN, | ||
permission_mod BOOLEAN, | ||
role_id_mod BOOLEAN, | ||
role_mod BOOLEAN, | ||
PRIMARY KEY (id, rev) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,8 @@ controller: | |
enabled: true | ||
resource: | ||
enabled: true | ||
roles: | ||
enabled: true | ||
|
||
upload: | ||
file: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
shogun-lib/src/main/java/de/terrestris/shogun/lib/controller/RoleController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* SHOGun, https://terrestris.github.io/shogun/ | ||
* | ||
* Copyright © 2024-present terrestris GmbH & Co. KG | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0.txt | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package de.terrestris.shogun.lib.controller; | ||
|
||
import de.terrestris.shogun.lib.model.Role; | ||
import de.terrestris.shogun.lib.service.RoleService; | ||
import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequestMapping("/roles") | ||
@ConditionalOnExpression("${controller.roles.enabled:true}") | ||
@Tag( | ||
name = "Roles", | ||
description = "The endpoints to manage roles" | ||
) | ||
@SecurityRequirement(name = "bearer-key") | ||
public class RoleController extends BaseController<RoleService, Role> { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.