API: Refactor ACL
This commit is contained in:
parent
651c4f12c1
commit
5f94f023ef
3 changed files with 24 additions and 24 deletions
|
@ -8,7 +8,7 @@ var Permissions = ACL{
|
|||
RoleAdmin: Actions{ActionDefault: true},
|
||||
RoleGuest: Actions{ActionRead: true},
|
||||
},
|
||||
ResourceOptions: Roles{
|
||||
ResourceConfigOptions: Roles{
|
||||
RoleAdmin: Actions{ActionDefault: true},
|
||||
},
|
||||
ResourceAlbums: Roles{
|
||||
|
|
|
@ -5,7 +5,7 @@ type Resource string
|
|||
const (
|
||||
ResourceDefault Resource = "*"
|
||||
ResourceConfig Resource = "config"
|
||||
ResourceOptions Resource = "options"
|
||||
ResourceConfigOptions Resource = "config_options"
|
||||
ResourceSettings Resource = "settings"
|
||||
ResourceLogs Resource = "logs"
|
||||
ResourceAccounts Resource = "accounts"
|
||||
|
|
|
@ -39,7 +39,7 @@ func GetConfig(router *gin.RouterGroup) {
|
|||
// GET /api/v1/config/options
|
||||
func GetConfigOptions(router *gin.RouterGroup) {
|
||||
router.GET("/config/options", func(c *gin.Context) {
|
||||
s := Auth(SessionID(c), acl.ResourceConfig, acl.ActionRead)
|
||||
s := Auth(SessionID(c), acl.ResourceConfigOptions, acl.ActionRead)
|
||||
conf := service.Config()
|
||||
|
||||
if s.Invalid() || conf.Public() || conf.DisableSettings() {
|
||||
|
@ -54,7 +54,7 @@ func GetConfigOptions(router *gin.RouterGroup) {
|
|||
// POST /api/v1/config/options
|
||||
func SaveConfigOptions(router *gin.RouterGroup) {
|
||||
router.POST("/config/options", func(c *gin.Context) {
|
||||
s := Auth(SessionID(c), acl.ResourceConfig, acl.ActionUpdate)
|
||||
s := Auth(SessionID(c), acl.ResourceConfigOptions, acl.ActionUpdate)
|
||||
conf := service.Config()
|
||||
|
||||
if s.Invalid() || conf.Public() || conf.DisableSettings() {
|
||||
|
|
Loading…
Reference in a new issue