mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +08:00
feat: fix bug that the default permission prevents admin to login in (#907)
* fix:The certs page is displayed incorrectly * Translations for each language are added * Replace the variables certificat with Certificat with certificate and Certificate * Replace the variables certificat with Certificat with certificate and Certificate * Variable names are more accurate * Variable names are more accurate * Modify the variable name * fix: Default action prevents admin to login in
This commit is contained in:
parent
8e98fc5a9f
commit
4e3eedf246
@ -236,7 +236,7 @@ func CheckAccessPermission(userId string, application *Application) (bool, error
|
|||||||
allowed := true
|
allowed := true
|
||||||
var err error
|
var err error
|
||||||
for _, permission := range permissions {
|
for _, permission := range permissions {
|
||||||
if !permission.IsEnabled {
|
if !permission.IsEnabled || len(permission.Users) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
func InitDb() {
|
func InitDb() {
|
||||||
existed := initBuiltInOrganization()
|
existed := initBuiltInOrganization()
|
||||||
if !existed {
|
if !existed {
|
||||||
|
initBuiltInPermission()
|
||||||
initBuiltInProvider()
|
initBuiltInProvider()
|
||||||
initBuiltInUser()
|
initBuiltInUser()
|
||||||
initBuiltInApplication()
|
initBuiltInApplication()
|
||||||
@ -230,3 +231,25 @@ func initBuiltInProvider() {
|
|||||||
func initWebAuthn() {
|
func initWebAuthn() {
|
||||||
gob.Register(webauthn.SessionData{})
|
gob.Register(webauthn.SessionData{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func initBuiltInPermission() {
|
||||||
|
permission := GetPermission("built-in/permission-built-in")
|
||||||
|
if permission != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
permission = &Permission{
|
||||||
|
Owner: "built-in",
|
||||||
|
Name: "permission-built-in",
|
||||||
|
CreatedTime: util.GetCurrentTime(),
|
||||||
|
DisplayName: "Built-in Permission",
|
||||||
|
Users: []string{"built-in/admin"},
|
||||||
|
Roles: []string{},
|
||||||
|
ResourceType: "Application",
|
||||||
|
Resources: []string{"app-built-in"},
|
||||||
|
Actions: []string{"Read", "Write", "Admin"},
|
||||||
|
Effect: "Allow",
|
||||||
|
IsEnabled: true,
|
||||||
|
}
|
||||||
|
AddPermission(permission)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user