mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-10-31 14:15:50 +00:00 
			
		
		
		
	fix: tinyauth should allow the user to access a resource if a whitelist is not setup
This commit is contained in:
		| @@ -40,7 +40,7 @@ | |||||||
|     "totpSuccessSubtitle": "Redirecting to your app", |     "totpSuccessSubtitle": "Redirecting to your app", | ||||||
|     "totpTitle": "Enter your TOTP code", |     "totpTitle": "Enter your TOTP code", | ||||||
|     "unauthorizedTitle": "Unauthorized", |     "unauthorizedTitle": "Unauthorized", | ||||||
|     "unauthorizedResourceSubtitle": "The user with username {{username}} is not authorized to access the resource <Code>{{resource}}</Code>.", |     "unauthorizedResourceSubtitle": "The user with username <Code>{{username}}<Code/> is not authorized to access the resource <Code>{{resource}}</Code>.", | ||||||
|     "unaothorizedLoginSubtitle": "The user with username {{username}} is not authorized to login.", |     "unaothorizedLoginSubtitle": "The user with username <Code>{{username}}<Code/> is not authorized to login.", | ||||||
|     "unauthorizedButton": "Try again" |     "unauthorizedButton": "Try again" | ||||||
| } | } | ||||||
| @@ -37,6 +37,7 @@ export const UnauthorizedPage = () => { | |||||||
|               <Trans |               <Trans | ||||||
|                 i18nKey="unauthorizedLoginSubtitle" |                 i18nKey="unauthorizedLoginSubtitle" | ||||||
|                 t={t} |                 t={t} | ||||||
|  |                 components={{ Code: <Code /> }} | ||||||
|                 values={{ username }} |                 values={{ username }} | ||||||
|               /> |               /> | ||||||
|             </Text> |             </Text> | ||||||
|   | |||||||
| @@ -295,6 +295,9 @@ func (auth *Auth) ResourceAllowed(c *gin.Context, context types.UserContext) (bo | |||||||
| 	// Check if user is allowed | 	// Check if user is allowed | ||||||
| 	if len(labels.Users) != 0 { | 	if len(labels.Users) != 0 { | ||||||
| 		log.Debug().Msg("Checking users") | 		log.Debug().Msg("Checking users") | ||||||
|  | 		if len(labels.Users) == 0 { | ||||||
|  | 			return true, nil | ||||||
|  | 		} | ||||||
| 		if slices.Contains(labels.Users, context.Username) { | 		if slices.Contains(labels.Users, context.Username) { | ||||||
| 			return true, nil | 			return true, nil | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Stavros
					Stavros