feat: add tags to application (#2027)

* feat: add tags to application

* fix: fix for merge master

* feat: update i18n(backend&frontend) for application tags
This commit is contained in:
haiwu
2023-06-30 00:04:12 +08:00
committed by GitHub
parent 1c42b6e395
commit 807aea5ec7
30 changed files with 76 additions and 12 deletions

View File

@ -69,6 +69,15 @@ func (c *ApiController) HandleLoggedIn(application *object.Application, user *ob
return
}
// check user's tag
if !user.IsGlobalAdmin && !user.IsAdmin && len(application.Tags) > 0 {
// only users with the tag that is listed in the application tags can login
if !util.InSlice(application.Tags, user.Tag) {
c.ResponseError(fmt.Sprintf(c.T("auth:User's tag: %s is not listed in the application's tags"), user.Tag))
return
}
}
if form.Password != "" && user.IsMfaEnabled() {
c.setMfaSessionData(&object.MfaSessionData{UserId: userId})
resp = &Response{Status: object.NextMfa, Data: user.GetPreferredMfaProps(true)}