mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
81e34d84de
* [MISC] Validate all sections of ACLs on startup This change ensure that all sections of the `access_control` key are validated on startup. * Change error format to clearly identify values
30 lines
595 B
Go
30 lines
595 B
Go
package authorization
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/authelia/authelia/internal/utils"
|
|
)
|
|
|
|
func isSubjectMatching(subject Subject, subjectRule []string) bool {
|
|
for _, ruleSubject := range subjectRule {
|
|
if strings.HasPrefix(ruleSubject, userPrefix) {
|
|
user := strings.Trim(ruleSubject[len(userPrefix):], " ")
|
|
if user == subject.Username {
|
|
continue
|
|
}
|
|
}
|
|
|
|
if strings.HasPrefix(ruleSubject, groupPrefix) {
|
|
group := strings.Trim(ruleSubject[len(groupPrefix):], " ")
|
|
if utils.IsStringInSlice(group, subject.Groups) {
|
|
continue
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|