Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Added the optional oauth allowed roles environment variable

Albert Nimtz015c03d42513
diff --git a/.example.env b/.example.env
index a99492ca5..4d0ee1818 100644
--- a/.example.env
+++ b/.example.env
@@ -23,6 +23,8 @@ OAUTH_GOOGLE_SECRET=
OAUTH_GITHUB_CLIENTID=
OAUTH_GITHUB_SECRET=
+OAUTH_ALLOWED_ROLES=
+
#EMAIL_MAILGUN_API=
diff --git a/app/actions/oauth.go b/app/actions/oauth.go
index 1b259c60f..67274a3d3 100644
--- a/app/actions/oauth.go
+++ b/app/actions/oauth.go
@@ -33,6 +33,7 @@ type CreateEditOAuthConfig struct {
JSONUserIDPath string `json:"jsonUserIDPath"`
JSONUserNamePath string `json:"jsonUserNamePath"`
JSONUserEmailPath string `json:"jsonUserEmailPath"`
+ JSONUserRolesPath string `json:"jsonUserRolesPath"`
}
func NewCreateEditOAuthConfig() *CreateEditOAuthConfig {
@@ -184,5 +185,9 @@ func (action *CreateEditOAuthConfig) Validate(ctx context.Context, user *entity.
result.AddFieldFailure("jsonUserEmailPath", "JSON User Email Path must have less than 100 characters.")
}
+ if len(action.JSONUserRolesPath) > 100 {
+ result.AddFieldFailure("jsonUserRolesPath", "JSON User Roles Path must have less than 100 characters.")
+ }
+
return result
}
diff --git a/app/cmd/routes.go b/app/cmd/routes.go
index b55a39c98..97e4fe1f7 100644
--- a/app/cmd/routes.go
+++ b/app/cmd/routes.go
@@ -120,6 +120,7 @@ func routes(r *web.Engine) *web.Engine {
r.Get("/signin/complete", handlers.CompleteSignInProfilePage())
r.Get("/loginemailsent", handlers.LoginEmailSentPage())
r.Get("/not-invited", handlers.NotInvitedPage())
+ r.Get("/access-denied", handlers.AccessDeniedPage())
r.Get("/signin/verify", handlers.VerifySignInKey(enum.EmailVerificationKindSignIn))
r.Get("/invite/verify", handlers.VerifySignInKey(enum.EmailVerificationKindUserInvitation))
r.Post("/_api/signin/complete", handlers.CompleteSignInProfile())
diff --git a/app/handlers/admin.go b/app/handlers/admin.go
index e21d3724a..17cea6d2e 100644
--- a/app/handlers/admin.go
+++ b/app/handlers/admin.go
@@ -242,6 +242,7 @@ func SaveOAuthConfig() web.HandlerFunc {
JSONUserIDPath: action.JSONUserIDPath,
JSONUserNamePath: action.JSONUserNamePath,
JSONUserEmailPath: action.JSONUserEmailPath,
+ JSONUserRolesPath: action.JSONUserRolesPath,
},
); err != nil {
return c.Failure(err)
diff --git a/app/handlers/oauth.go b/app/handlers/oauth.go
index 2a8672097..6a46e50e2 100644
--- a/app/handlers/oauth.go
+++ b/app/handlers/oauth.go
@@ -17,6 +17,7 @@ import (
"github.com/getfider/fider/app/pkg/bus"
"github.com/getfider/fider/app"
+ "github.com/getfider/fider/app/pkg/env"
"github.com/getfider/fider/app/pkg/errors"
"github.com/getfider/fider/app/pkg/jwt"
"github.com/getfider/fider/app/pkg/log"
@@ -91,6 +92,17 @@ func OAuthToken() web.HandlerFunc {
return c.Failure(err)
}
+ // Check if user has required roles (if OAUTH_ALLOWED_ROLES is configured)
+ if !hasAllowedRole(oauthUser.Result.Roles) {
+ log.Warnf(c, "User @{UserID} attempted OAuth login but does not have required role. User roles: @{UserRoles}, Allowed roles: @{AllowedRoles}",
+ dto.Props{
+ "UserID": oauthUser.Result.ID,
+ "UserRoles": oauthUser.Result.Roles,
+ "AllowedRoles": env.Config.OAuth.AllowedRoles,
+ })
+ return c.Redirect("/access-denied")
+ }
+
var user *entity.User
userByProvider := &query.GetUserByProvider{Provider: provider, UID: oauthUser.Result.ID}
@@ -264,3 +276,42 @@ func SignInByOAuth() web.HandlerFunc {
return c.Redirect(authURL.Result)
}
}
+
+// hasAllowedRole checks if the user has any of the allowed roles configured in OAUTH_ALLOWED_ROLES
+// If OAUTH_ALLOWED_ROLES is not set or empty, all users are allowed (returns true)
+// If set, user must have at least one of the specified roles
+func hasAllowedRole(userRoles []string) bool {
+ allowedRolesConfig := strings.TrimSpace(env.Config.OAuth.AllowedRoles)
+
+ // If no roles restriction is configured, allow all users
+ if allowedRolesConfig == "" {
+ return true
+ }
+
+ // Parse allowed roles from config (semicolon-separated)
+ allowedRoles := strings.Split(allowedRolesConfig, ";")
+ allowedRolesMap := make(map[string]bool)
+ for _, role := range allowedRoles {
+ role = strings.TrimSpace(role)
+ if role != "" {
+ allowedRolesMap[role] = true
+ }
+ }
+
+ // If no valid roles in config, allow all
+ if len(allowedRolesMap) == 0 {
+ return true
+ }
+
+ // Check if user has any of the allowed roles
+ for _, userRole := range userRoles {
+ userRole = strings.TrimSpace(userRole)
+ if allowedRolesMap[userRole] {
+ return true
+ }
+ }
+
+ // User doesn't have any of the required roles
+ return false
+}
+
diff --git a/app/handlers/signin.go b/app/handlers/signin.go
index df03aa133..5c350096f 100644
--- a/app/handlers/signin.go
+++ b/app/handlers/signin.go
@@ -71,6 +71,17 @@ func NotInvitedPage() web.HandlerFunc {
}
}
+// AccessDeniedPage renders the access denied page for OAuth role mismatches
+func AccessDeniedPage() web.HandlerFunc {
+ return func(c *web.Context) error {
+ return c.Page(http.StatusForbidden, web.Props{
+ Page: "Error/AccessDenied.page",
+ Title: "Access Denied",
+ Description: "You do not have the required permissions to access this site.",
+ })
+ }
+}
+
// SignInByEmail checks if user exists and sends code only for existing users
func SignInByEmail() web.HandlerFunc {
return func(c *web.Context) error {
diff --git a/app/models/cmd/oauth.go b/app/models/cmd/oauth.go
index 2a05f9d47..db1947ab0 100644
--- a/app/models/cmd/oauth.go
+++ b/app/models/cmd/oauth.go
@@ -20,6 +20,7 @@ type SaveCustomOAuthConfig struct {
JSONUserIDPath string
JSONUserNamePath string
JSONUserEmailPath string
+ JSONUserRolesPath string
}
type ParseOAuthRawProfile struct {
diff --git a/app/models/dto/oauth.go b/app/models/dto/oauth.go
index bde602df6..d6b9b27c2 100644
--- a/app/models/dto/oauth.go
+++ b/app/models/dto/oauth.go
@@ -2,9 +2,10 @@ package dto
//OAuthUserProfile represents an OAuth user profile
type OAuthUserProfile struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Email string `json:"email"`
+ ID string `json:"id"`
+ Name string `json:"name"`
+ Email string `json:"email"`
+ Roles []string `json:"roles"`
}
//OAuthProviderOption represents an OAuth provider that can be used to authenticate
diff --git a/app/models/entity/oauth.go b/app/models/entity/oauth.go
index d0a49fd41..08a451712 100644
--- a/app/models/entity/oauth.go
+++ b/app/models/entity/oauth.go
@@ -27,6 +27,7 @@ type OAuthConfig struct {
JSONUserIDPath string
JSONUserNamePath string
JSONUserEmailPath string
+ JSONUserRolesPath string
}
// MarshalJSON returns the JSON encoding of OAuthConfig
@@ -51,5 +52,6 @@ func (o OAuthConfig) MarshalJSON() ([]byte, error) {
"jsonUserIDPath": o.JSONUserIDPath,
"jsonUserNamePath": o.JSONUserNamePath,
"jsonUserEmailPath": o.JSONUserEmailPath,
+ "jsonUserRolesPath": o.JSONUserRolesPath,
})
}
diff --git a/app/pkg/env/env.go b/app/pkg/env/env.go
index fc1fee739..2edd69977 100644
--- a/app/pkg/env/env.go
+++ b/app/pkg/env/env.go
@@ -99,6 +99,7 @@ type config struct {
ClientID string `env:"OAUTH_GITHUB_CLIENTID"`
Secret string `env:"OAUTH_GITHUB_SECRET"`
}
+ AllowedRoles string `env:"OAUTH_ALLOWED_ROLES"`
}
Email struct {
Type string `env:"EMAIL"` // possible values: smtp, mailgun, awsses
diff --git a/app/services/oauth/oauth.go b/app/services/oauth/oauth.go
index 87086d9c6..bfffa84ae 100644
--- a/app/services/oauth/oauth.go
+++ b/app/services/oauth/oauth.go
@@ -3,6 +3,7 @@ package oauth
import (
"context"
"encoding/base64"
+ "encoding/json"
"fmt"
"net/url"
"strings"
@@ -120,10 +121,17 @@ func parseOAuthRawProfile(ctx context.Context, c *cmd.ParseOAuthRawProfile) erro
// Extract and combine name parts
name := extractCompositeName(query, config.JSONUserNamePath)
+ // Extract roles if path is configured
+ var roles []string
+ if config.JSONUserRolesPath != "" {
+ roles = extractRolesFromJSON(c.Body, config.JSONUserRolesPath)
+ }
+
profile := &dto.OAuthUserProfile{
ID: strings.TrimSpace(query.String(config.JSONUserIDPath)),
Name: name,
Email: strings.ToLower(strings.TrimSpace(query.String(config.JSONUserEmailPath))),
+ Roles: roles,
}
if profile.ID == "" {
@@ -193,6 +201,130 @@ func extractCompositeName(query *jsonq.Query, namePath string) string {
return ""
}
+// Supports formats:
+// - "roles" for array of strings: ["ROLE_ADMIN", "ROLE_USER"]
+// - "roles[].id" for array of objects: [{"id": "ROLE_ADMIN"}, {"id": "ROLE_USER"}]
+// - "user.roles[].name" for nested array of objects
+func extractRolesFromJSON(jsonBody string, rolesPath string) []string {
+ rolesPath = strings.TrimSpace(rolesPath)
+ if rolesPath == "" {
+ return nil
+ }
+
+ // Parse the JSON body
+ var data map[string]interface{}
+ if err := json.Unmarshal([]byte(jsonBody), &data); err != nil {
+ return nil
+ }
+
+ // Check if we need to extract a field from array of objects (e.g., "roles[].id")
+ var fieldToExtract string
+ var actualPath string
+
+ if strings.Contains(rolesPath, "[].") {
+ parts := strings.Split(rolesPath, "[].")
+ if len(parts) == 2 {
+ actualPath = parts[0]
+ fieldToExtract = parts[1]
+ }
+ } else {
+ actualPath = rolesPath
+ }
+
+ // Navigate to the value using the path
+ value := navigateJSONPath(data, actualPath)
+ if value == nil {
+ return nil
+ }
+
+ // If it's an array
+ if arr, ok := value.([]interface{}); ok {
+ roles := make([]string, 0)
+
+ // If we need to extract a field from objects
+ if fieldToExtract != "" {
+ for _, item := range arr {
+ if obj, ok := item.(map[string]interface{}); ok {
+ if fieldValue, exists := obj[fieldToExtract]; exists {
+ if roleStr, ok := fieldValue.(string); ok && roleStr != "" {
+ roles = append(roles, strings.TrimSpace(roleStr))
+ }
+ }
+ }
+ }
+ } else {
+ // Array of strings
+ for _, item := range arr {
+ if roleStr, ok := item.(string); ok && roleStr != "" {
+ roles = append(roles, strings.TrimSpace(roleStr))
+ }
+ }
+ }
+
+ if len(roles) > 0 {
+ return roles
+ }
+ }
+
+ // If it's a string, try splitting
+ if str, ok := value.(string); ok {
+ str = strings.TrimSpace(str)
+ if str != "" {
+ // Try splitting by semicolon first, then comma
+ var roles []string
+ if strings.Contains(str, ";") {
+ roles = strings.Split(str, ";")
+ } else if strings.Contains(str, ",") {
+ roles = strings.Split(str, ",")
+ } else {
+ roles = []string{str}
+ }
+
+ // Trim whitespace from each role
+ cleanRoles := make([]string, 0)
+ for _, role := range roles {
+ role = strings.TrimSpace(role)
+ if role != "" {
+ cleanRoles = append(cleanRoles, role)
+ }
+ }
+ return cleanRoles
+ }
+ }
+
+ return nil
+}
+
+// navigateJSONPath navigates through nested JSON structure using dot notation
+// e.g., "user.profile.roles" will navigate data["user"]["profile"]["roles"]
+func navigateJSONPath(data map[string]interface{}, path string) interface{} {
+ if path == "" {
+ return nil
+ }
+
+ parts := strings.Split(path, ".")
+ var current interface{} = data
+
+ for _, part := range parts {
+ part = strings.TrimSpace(part)
+ if part == "" {
+ continue
+ }
+
+ if m, ok := current.(map[string]interface{}); ok {
+ if value, exists := m[part]; exists {
+ current = value
+ } else {
+ return nil
+ }
+ } else {
+ return nil
+ }
+ }
+
+ return current
+}
+
func getOAuthAuthorizationURL(ctx context.Context, q *query.GetOAuthAuthorizationURL) error {
config, err := getConfig(ctx, q.Provider)
if err != nil {
diff --git a/app/services/oauth/roles_test.go b/app/services/oauth/roles_test.go
new file mode 100644
index 000000000..ae07583a7
--- /dev/null
+++ b/app/services/oauth/roles_test.go
@@ -0,0 +1,76 @@
+package oauth
+
+import (
+ "testing"
+)
+
+func TestExtractRolesFromJSON_ArrayOfObjects(t *testing.T) {
+ // IServ-style response
+ jsonBody := `{
+ "email": "[email protected]",
+ "roles": [
+ {
+ "uuid": "c9b85a22-1a6c-46e1-99eb-36cb88001fda",
+ "id": "ROLE_TEACHER",
+ "displayName": "Lehrer"
+ },
+ {
+ "uuid": "f66aee04-c335-4299-9cfe-ca7176cc0213",
+ "id": "ROLE_ADMIN",
+ "displayName": "Administrator"
+ }
+ ]
+ }`
+
+ roles := extractRolesFromJSON(jsonBody, "roles[].id")
+
+ if len(roles) != 2 {
+ t.Errorf("Expected 2 roles, got %d", len(roles))
+ }
+
+ if roles[0] != "ROLE_TEACHER" {
+ t.Errorf("Expected first role to be ROLE_TEACHER, got %s", roles[0])
+ }
+
+ if roles[1] != "ROLE_ADMIN" {
+ t.Errorf("Expected second role to be ROLE_ADMIN, got %s", roles[1])
+ }
+}
+
+func TestExtractRolesFromJSON_ArrayOfStrings(t *testing.T) {
+ jsonBody := `{
+ "email": "[email protected]",
+ "roles": ["ROLE_ADMIN", "ROLE_USER"]
+ }`
+
+ roles := extractRolesFromJSON(jsonBody, "roles")
+
+ if len(roles) != 2 {
+ t.Errorf("Expected 2 roles, got %d", len(roles))
+ }
+
+ if roles[0] != "ROLE_ADMIN" {
+ t.Errorf("Expected first role to be ROLE_ADMIN, got %s", roles[0])
+ }
+}
+
+func TestExtractRolesFromJSON_NestedPath(t *testing.T) {
+ jsonBody := `{
+ "user": {
+ "profile": {
+ "roles": ["ROLE_ADMIN"]
+ }
+ }
+ }`
+
+ roles := extractRolesFromJSON(jsonBody, "user.profile.roles")
+
+ if len(roles) != 1 {
+ t.Errorf("Expected 1 role, got %d", len(roles))
+ }
+
+ if roles[0] != "ROLE_ADMIN" {
+ t.Errorf("Expected role to be ROLE_ADMIN, got %s", roles[0])
+ }
+}
+
diff --git a/app/services/sqlstore/dbEntities/oauth.go b/app/services/sqlstore/dbEntities/oauth.go
index 32c973af1..1d41823d4 100644
--- a/app/services/sqlstore/dbEntities/oauth.go
+++ b/app/services/sqlstore/dbEntities/oauth.go
@@ -1,28 +1,36 @@
package dbEntities
import (
+ "database/sql"
+
"github.com/getfider/fider/app/models/entity"
)
type OAuthConfig struct {
- ID int `db:"id"`
- Provider string `db:"provider"`
- DisplayName string `db:"display_name"`
- LogoBlobKey string `db:"logo_bkey"`
- Status int `db:"status"`
- IsTrusted bool `db:"is_trusted"`
- ClientID string `db:"client_id"`
- ClientSecret string `db:"client_secret"`
- AuthorizeURL string `db:"authorize_url"`
- TokenURL string `db:"token_url"`
- Scope string `db:"scope"`
- ProfileURL string `db:"profile_url"`
- JSONUserIDPath string `db:"json_user_id_path"`
- JSONUserNamePath string `db:"json_user_name_path"`
- JSONUserEmailPath string `db:"json_user_email_path"`
+ ID int `db:"id"`
+ Provider string `db:"provider"`
+ DisplayName string `db:"display_name"`
+ LogoBlobKey string `db:"logo_bkey"`
+ Status int `db:"status"`
+ IsTrusted bool `db:"is_trusted"`
+ ClientID string `db:"client_id"`
+ ClientSecret string `db:"client_secret"`
+ AuthorizeURL string `db:"authorize_url"`
+ TokenURL string `db:"token_url"`
+ Scope string `db:"scope"`
+ ProfileURL string `db:"profile_url"`
+ JSONUserIDPath string `db:"json_user_id_path"`
+ JSONUserNamePath string `db:"json_user_name_path"`
+ JSONUserEmailPath string `db:"json_user_email_path"`
+ JSONUserRolesPath sql.NullString `db:"json_user_roles_path"`
}
func (m *OAuthConfig) ToModel() *entity.OAuthConfig {
+ rolesPath := ""
+ if m.JSONUserRolesPath.Valid {
+ rolesPath = m.JSONUserRolesPath.String
+ }
+
return &entity.OAuthConfig{
ID: m.ID,
Provider: m.Provider,
@@ -39,5 +47,6 @@ func (m *OAuthConfig) ToModel() *entity.OAuthConfig {
JSONUserIDPath: m.JSONUserIDPath,
JSONUserNamePath: m.JSONUserNamePath,
JSONUserEmailPath: m.JSONUserEmailPath,
+ JSONUserRolesPath: rolesPath,
}
}
diff --git a/app/services/sqlstore/postgres/oauth.go b/app/services/sqlstore/postgres/oauth.go
index 16bca0964..916eec43e 100644
--- a/app/services/sqlstore/postgres/oauth.go
+++ b/app/services/sqlstore/postgres/oauth.go
@@ -24,7 +24,7 @@ func getCustomOAuthConfigByProvider(ctx context.Context, q *query.GetCustomOAuth
SELECT id, provider, display_name, status, is_trusted, logo_bkey,
client_id, client_secret, authorize_url,
profile_url, token_url, scope, json_user_id_path,
- json_user_name_path, json_user_email_path
+ json_user_name_path, json_user_email_path, json_user_roles_path
FROM oauth_providers
WHERE tenant_id = $1 AND provider = $2
`, tenant.ID, q.Provider)
@@ -49,7 +49,7 @@ func listCustomOAuthConfig(ctx context.Context, q *query.ListCustomOAuthConfig)
SELECT id, provider, display_name, status, is_trusted, logo_bkey,
client_id, client_secret, authorize_url,
profile_url, token_url, scope, json_user_id_path,
- json_user_name_path, json_user_email_path
+ json_user_name_path, json_user_email_path, json_user_roles_path
FROM oauth_providers
WHERE tenant_id = $1
ORDER BY id`, tenant.ID)
@@ -79,29 +79,29 @@ func saveCustomOAuthConfig(ctx context.Context, c *cmd.SaveCustomOAuthConfig) er
tenant_id, provider, display_name, status, is_trusted,
client_id, client_secret, authorize_url,
profile_url, token_url, scope, json_user_id_path,
- json_user_name_path, json_user_email_path, logo_bkey
- ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)
+ json_user_name_path, json_user_email_path, json_user_roles_path, logo_bkey
+ ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
RETURNING id`
err = trx.Get(&c.ID, query, tenant.ID, c.Provider,
c.DisplayName, c.Status, c.IsTrusted, c.ClientID, c.ClientSecret,
c.AuthorizeURL, c.ProfileURL, c.TokenURL,
c.Scope, c.JSONUserIDPath, c.JSONUserNamePath,
- c.JSONUserEmailPath, c.Logo.BlobKey)
+ c.JSONUserEmailPath, c.JSONUserRolesPath, c.Logo.BlobKey)
} else {
query := `
UPDATE oauth_providers
SET display_name = $3, status = $4, client_id = $5, client_secret = $6,
authorize_url = $7, profile_url = $8, token_url = $9, scope = $10,
json_user_id_path = $11, json_user_name_path = $12, json_user_email_path = $13,
- logo_bkey = $14, is_trusted = $15
+ json_user_roles_path = $14, logo_bkey = $15, is_trusted = $16
WHERE tenant_id = $1 AND id = $2`
_, err = trx.Execute(query, tenant.ID, c.ID,
c.DisplayName, c.Status, c.ClientID, c.ClientSecret,
c.AuthorizeURL, c.ProfileURL, c.TokenURL,
c.Scope, c.JSONUserIDPath, c.JSONUserNamePath,
- c.JSONUserEmailPath, c.Logo.BlobKey, c.IsTrusted)
+ c.JSONUserEmailPath, c.JSONUserRolesPath, c.Logo.BlobKey, c.IsTrusted)
}
if err != nil {
diff --git a/docs/OAUTH_ROLE_RESTRICTION.md b/docs/OAUTH_ROLE_RESTRICTION.md
new file mode 100644
index 000000000..cca21c36e
--- /dev/null
+++ b/docs/OAUTH_ROLE_RESTRICTION.md
@@ -0,0 +1,119 @@
+# OAuth Role-Based Access Control
+
+This feature allows you to restrict OAuth login to users who have specific roles provided by your OAuth provider.
+
+## Configuration
+
+### Environment Variable
+
+Add the following environment variable to your `.env` file:
+
+```bash
+OAUTH_ALLOWED_ROLES=ROLE_ADMIN;ROLE_TEACHER
+```
+
+- **Format**: Semicolon-separated list of role names
+- **Case-sensitive**: Role names are matched exactly as they appear in the OAuth response
+- **Optional**: If not set or empty, all users are allowed to login (default behavior)
+
+### Examples
+
+#### Allow only admins:
+```bash
+OAUTH_ALLOWED_ROLES=ROLE_ADMIN
+```
+
+#### Allow admins and teachers:
+```bash
+OAUTH_ALLOWED_ROLES=ROLE_ADMIN;ROLE_TEACHER
+```
+
+#### Allow all users (default):
+```bash
+# Don't set OAUTH_ALLOWED_ROLES or leave it empty
+OAUTH_ALLOWED_ROLES=
+```
+
+## OAuth Provider Configuration
+
+For custom OAuth providers, you need to configure the JSON path to extract roles from the OAuth response.
+
+### Admin Panel Configuration
+
+1. Go to **Site Settings** → **Authentication** → **OAuth Providers**
+2. Edit or create a custom OAuth provider
+3. Configure the **JSON User Roles Path** field
+
+### JSON User Roles Path Examples
+
+The roles path supports various OAuth response formats:
+
+#### Array of strings:
+```json
+{
+ "id": "12345",
+ "name": "John Doe",
+ "email": "[email protected]",
+ "roles": ["ROLE_ADMIN", "ROLE_TEACHER"]
+}
+```
+**JSON User Roles Path**: `roles`
+
+#### Array of objects (extract specific field):
+```json
+{
+ "id": "12345",
+ "roles": [
+ { "id": "ROLE_ADMIN", "displayName": "Administrator" },
+ { "id": "ROLE_TEACHER", "displayName": "Teacher" }
+ ]
+}
+```
+**JSON User Roles Path**: `roles[].id`
+
+This extracts the `id` field from each object in the `roles` array.
+
+#### Nested array:
+```json
+{
+ "id": "12345",
+ "user": {
+ "profile": {
+ "roles": ["ROLE_ADMIN"]
+ }
+ }
+}
+```
+**JSON User Roles Path**: `user.profile.roles`
+
+#### Nested array of objects:
+```json
+{
+ "id": "12345",
+ "user": {
+ "groups": [
+ { "name": "ROLE_ADMIN" },
+ { "name": "ROLE_USER" }
+ ]
+ }
+}
+```
+**JSON User Roles Path**: `user.groups[].name`
+
+#### Comma or semicolon-separated string:
+```json
+{
+ "id": "12345",
+ "roles": "ROLE_ADMIN,ROLE_TEACHER"
+}
+```
+**JSON User Roles Path**: `roles`
+
+#### Single role as string:
+```json
+{
+ "id": "12345",
+ "role": "ROLE_ADMIN"
+}
+```
+**JSON User Roles Path**: `role`
diff --git a/locale/ar/client.json b/locale/ar/client.json
index 4098b3a0f..b4aadaa5c 100644
--- a/locale/ar/client.json
+++ b/locale/ar/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "فتح",
"enum.poststatus.planned": "مخطط",
"enum.poststatus.started": "بدأت",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "انتهت صَلاحِيَة الرابط الذي ضغطت عليه.",
"error.expired.title": "منتهية الصَّلاحِيَة",
"error.forbidden.text": "لا تملك الصلاحيات لتصفح هذه الصفحة.",
diff --git a/locale/de/client.json b/locale/de/client.json
index 52a2e63c5..58772c867 100644
--- a/locale/de/client.json
+++ b/locale/de/client.json
@@ -6,18 +6,18 @@
"action.confirm": "Bestätigen",
"action.copylink": "Link kopieren",
"action.delete": "Löschen",
- "action.delete.block": "",
+ "action.delete.block": "Löschen & Blockieren",
"action.edit": "Bearbeiten",
"action.markallasread": "Alle als gelesen markieren",
"action.ok": "OK",
- "action.postcomment": "",
+ "action.postcomment": "Senden",
"action.postsfeed": "Beiträge-Feed",
- "action.publish": "",
- "action.publish.verify": "",
+ "action.publish": "Veröffentlichen",
+ "action.publish.verify": "Veröffentlichen & Vertrauen",
"action.respond": "Antworten",
"action.save": "Sichern",
"action.signin": "Anmelden",
- "action.signup": "Melden Sie sich an",
+ "action.signup": "Registrieren",
"action.submit": "Absenden",
"action.vote": "Abstimmen",
"action.voted": "Abgestimmt!",
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Offen",
"enum.poststatus.planned": "Geplant",
"enum.poststatus.started": "Gestartet",
+ "error.accessdenied.contact": "Wenn du glaubst, dass dies ein Fehler ist, wende dich bitte an deinen Administrator.",
+ "error.accessdenied.text": "Du hast nicht die erforderlichen Berechtigungen, um auf diese Seite zuzugreifen.",
+ "error.accessdenied.title": "Zugriff verweigert",
"error.expired.text": "Der Link, dem du gefolgt bist, ist abgelaufen.",
"error.expired.title": "Abgelaufen",
"error.forbidden.text": "Du bist nicht berechtigt diese Seite anzuschauen.",
@@ -44,11 +47,11 @@
"error.unauthorized.title": "Nicht berechtigt",
"home.filter.label": "Filter",
"home.filter.search.label": "Filter durchsuchen...",
- "home.form.defaultinvitation": "Gib hier Deinen Vorschlag ein...",
- "home.form.defaultwelcomemessage": "Wir würden gerne erfahren, worüber Du nachdenkst.\n\nWas können wir verbessern? Hier kannst Du abstimmen, diskutieren und neue Ideen vorschlagen.",
+ "home.form.defaultinvitation": "Gib hier deinen Vorschlag ein...",
+ "home.form.defaultwelcomemessage": "Wir würden gerne erfahren, worüber du nachdenkst.\n\nWas können wir verbessern? Hier kannst du abstimmen, diskutieren und neue Ideen vorschlagen.",
"home.lonely.suggestion": "Es wird empfohlen, dass du <0>mindestens 3</0> Vorschläge hier erstellst, bevor du diese Seite teilst. Der anfängliche Inhalt ist wichtig, um die Interaktion mit deiner Zielgruppe zu fördern.",
"home.lonely.text": "Es wurden noch keine Beiträge erstellt.",
- "home.postfilter.label.moderation": "",
+ "home.postfilter.label.moderation": "Moderation",
"home.postfilter.label.myactivity": "Meine Aktivität",
"home.postfilter.label.status": "Status",
"home.postfilter.option.mostdiscussed": "Am häufigsten diskutiert",
@@ -82,9 +85,9 @@
"label.tags": "Tags",
"label.unread": "Ungelesen",
"label.unsubscribe": "Abbestellen",
- "label.vote": "",
+ "label.vote": "Abstimmen",
"label.voters": "Wähler",
- "label.votes": "",
+ "label.votes": "Stimmen",
"labels.notagsavailable": "Keine Tags verfügbar",
"legal.agreement": "Ich habe die <0/> und <1/> gelesen und akzeptiere sie.",
"legal.notice": "Mit der Anmeldung stimmst du den <0/><1/> und <2/> zu.",
@@ -94,17 +97,17 @@
"linkmodal.text.label": "Anzuzeigender Text",
"linkmodal.text.placeholder": "Linktext eingeben",
"linkmodal.title": "Link einfügen",
- "linkmodal.url.label": "",
- "linkmodal.url.placeholder": "",
+ "linkmodal.url.label": "URL",
+ "linkmodal.url.placeholder": "https://example.com",
"menu.administration": "Verwaltung",
"menu.mysettings": "Meine Einstellungen",
"menu.signout": "Abmelden",
"menu.sitesettings": "Seiteneinstellungen",
"modal.changeemail.header": "Bestätige deine neue E-Mail-Adresse",
"modal.changeemail.text": "Wir haben soeben einen Bestätigungslink an <0>{0}</0> gesendet. <1/> Klicke auf den Link, um deine E-Mail zu aktualisieren.",
- "modal.completeprofile.header": "Vervollständige Dein Profil",
+ "modal.completeprofile.header": "Vervollständige dein Profil",
"modal.completeprofile.name.placeholder": "Name",
- "modal.completeprofile.text": "Da dies dein erster Login ist, gebe bitte einen Namen an.",
+ "modal.completeprofile.text": "Da dies dein erster Login ist, gib bitte deinen Namen ein.",
"modal.deleteaccount.header": "Account löschen",
"modal.deleteaccount.text": "<0>Wenn du dein Konto löschst, werden wir all deine persönlichen Daten für immer löschen. Der von dir veröffentlichte Inhalt bleibt erhalten, wird aber anonymisiert.</0><1>Dieser Prozess ist unumkehrbar. <2>Bist du sicher? </2></1>",
"modal.deletecomment.header": "Kommentar löschen",
@@ -117,26 +120,26 @@
"modal.showvotes.message.zeromatches": "Keine Benutzer gefunden, die <0>{0}</0> entsprechen.",
"modal.showvotes.query.placeholder": "Suche nach Benutzern nach Namen...",
"modal.signin.header": "Reiche dein Feedback ein",
- "moderation.comment.delete.block.error": "",
- "moderation.comment.delete.error": "",
- "moderation.comment.deleted": "",
- "moderation.comment.deleted.blocked": "",
- "moderation.comment.publish.error": "",
- "moderation.comment.publish.verify.error": "",
- "moderation.comment.published": "",
- "moderation.comment.published.verified": "",
- "moderation.empty": "",
- "moderation.fetch.error": "",
- "moderation.post.delete.block.error": "",
- "moderation.post.delete.error": "",
- "moderation.post.deleted": "",
- "moderation.post.deleted.blocked": "",
- "moderation.post.publish.error": "",
- "moderation.post.publish.verify.error": "",
- "moderation.post.published": "",
- "moderation.post.published.verified": "",
- "moderation.subtitle": "",
- "moderation.title": "",
+ "moderation.comment.delete.block.error": "Fehler beim Löschen des Kommentars und Blockieren des Benutzers",
+ "moderation.comment.delete.error": "Fehler beim Löschen des Kommentars",
+ "moderation.comment.deleted": "Kommentar erfolgreich gelöscht",
+ "moderation.comment.deleted.blocked": "Kommentar gelöscht und Benutzer blockiert",
+ "moderation.comment.publish.error": "Fehler beim Veröffentlichen des Kommentars",
+ "moderation.comment.publish.verify.error": "Fehler beim Veröffentlichen des Kommentars und Verifizieren des Benutzers",
+ "moderation.comment.published": "Kommentar erfolgreich veröffentlicht",
+ "moderation.comment.published.verified": "Kommentar veröffentlicht und Benutzer verifiziert",
+ "moderation.empty": "Alle Inhalte wurden moderiert. Du bist auf dem neuesten Stand!",
+ "moderation.fetch.error": "Fehler beim Abrufen der Moderationselemente",
+ "moderation.post.delete.block.error": "Fehler beim Löschen des Beitrags und Blockieren des Benutzers",
+ "moderation.post.delete.error": "Fehler beim Löschen des Beitrags",
+ "moderation.post.deleted": "Beitrag erfolgreich gelöscht",
+ "moderation.post.deleted.blocked": "Beitrag gelöscht und Benutzer blockiert",
+ "moderation.post.publish.error": "Fehler beim Veröffentlichen des Beitrags",
+ "moderation.post.publish.verify.error": "Fehler beim Veröffentlichen des Beitrags und Verifizieren des Benutzers",
+ "moderation.post.published": "Beitrag erfolgreich veröffentlicht",
+ "moderation.post.published.verified": "Beitrag veröffentlicht und Benutzer verifiziert",
+ "moderation.subtitle": "Diese Ideen und Kommentare stammen von Personen außerhalb deiner Liste vertrauenswürdiger Benutzer. Du entscheidest, ob sie veröffentlicht werden.",
+ "moderation.title": "Moderationswarteschlange",
"mynotifications.label.readrecently": "Lies, was in den letzten 30 Tagen geschrieben wurde.",
"mynotifications.message.nounread": "Keine ungelesenen Benachrichtigungen.",
"mynotifications.page.subtitle": "Bleibe immer auf dem Laufenden",
@@ -172,53 +175,53 @@
"newpost.modal.title.label": "Gib deiner Idee einen Titel",
"newpost.modal.title.placeholder": "Eine kurze und knappe Zusammenfassung in wenigen Worten",
"page.backhome": "Zurück zur <0>{0}</0> Homepage.",
- "page.pendingactivation.didntreceive": "Haben Sie die E-Mail nicht erhalten?",
+ "page.pendingactivation.didntreceive": "Hast du die E-Mail nicht erhalten?",
"page.pendingactivation.resend": "Bestätigungs-E-Mail erneut senden",
"page.pendingactivation.resending": "Erneut gesendet...",
- "page.pendingactivation.text": "Wir haben Ihnen eine Bestätigungs-E-Mail mit einem Link zur Aktivierung Ihrer Website geschickt.",
+ "page.pendingactivation.text": "Wir haben dir eine Bestätigungs-E-Mail mit einem Link zur Aktivierung deiner Website geschickt.",
"page.pendingactivation.text2": "Bitte überprüfe deinen Posteingang, um ihn zu aktivieren.",
"page.pendingactivation.title": "Dein Account ist nicht aktiviert",
- "pagination.next": "",
- "pagination.prev": "",
- "post.pending": "",
- "postdetails.backtoall": "",
+ "pagination.next": "Weiter",
+ "pagination.prev": "Zurück",
+ "post.pending": "ausstehend",
+ "postdetails.backtoall": "Zurück zu allen Vorschlägen",
"showpost.comment.copylink.error": "Kommentar-Link konnte nicht kopiert werden, bitte URL der Webseite kopieren",
"showpost.comment.copylink.success": "Kommentar-Link in die Zwischenablage kopiert",
"showpost.comment.unknownhighlighted": "Ungültige Kommentar ID #{id}",
"showpost.commentinput.placeholder": "Kommentar hinzufügen",
"showpost.copylink.success": "Link in die Zwischenablage kopiert",
- "showpost.loading": "",
+ "showpost.loading": "Lädt...",
"showpost.message.nodescription": "Keine Beschreibung angegeben.",
- "showpost.moderation.admin.description": "",
- "showpost.moderation.admin.title": "",
- "showpost.moderation.approved": "",
- "showpost.moderation.approveerror": "",
- "showpost.moderation.awaiting": "",
- "showpost.moderation.comment.admin.description": "",
- "showpost.moderation.comment.approved": "",
- "showpost.moderation.comment.approveerror": "",
- "showpost.moderation.comment.awaiting": "",
- "showpost.moderation.comment.declined": "",
- "showpost.moderation.comment.declineerror": "",
- "showpost.moderation.commentsuccess": "",
- "showpost.moderation.declined": "",
- "showpost.moderation.declineerror": "",
- "showpost.moderation.postsuccess": "",
+ "showpost.moderation.admin.description": "Diese Idee benötigt deine Genehmigung, bevor sie veröffentlicht wird",
+ "showpost.moderation.admin.title": "Moderation",
+ "showpost.moderation.approved": "Beitrag erfolgreich genehmigt",
+ "showpost.moderation.approveerror": "Fehler beim Genehmigen des Beitrags",
+ "showpost.moderation.awaiting": "Wartet auf Moderation.",
+ "showpost.moderation.comment.admin.description": "Dieser Kommentar benötigt deine Genehmigung, bevor er veröffentlicht wird",
+ "showpost.moderation.comment.approved": "Kommentar erfolgreich genehmigt",
+ "showpost.moderation.comment.approveerror": "Fehler beim Genehmigen des Kommentars",
+ "showpost.moderation.comment.awaiting": "Wartet auf Moderation.",
+ "showpost.moderation.comment.declined": "Kommentar erfolgreich abgelehnt",
+ "showpost.moderation.comment.declineerror": "Fehler beim Ablehnen des Kommentars",
+ "showpost.moderation.commentsuccess": "Dein Kommentar wartet auf Moderation 📝",
+ "showpost.moderation.declined": "Beitrag erfolgreich abgelehnt",
+ "showpost.moderation.declineerror": "Fehler beim Ablehnen des Beitrags",
+ "showpost.moderation.postsuccess": "Deine Idee wartet auf Moderation 📝",
"showpost.moderationpanel.text.help": "Diese Aktion <0>kann nicht</0> rückgängig gemacht werden.",
"showpost.moderationpanel.text.placeholder": "Warum löschst du diesen Beitrag? (optional)",
"showpost.notificationspanel.message.subscribed": "Du erhältst Benachrichtigungen über Aktivitäten auf diesem Beitrag.",
"showpost.notificationspanel.message.unsubscribed": "Du erhältst keine Benachrichtigungen über diesen Beitrag.",
- "showpost.postedby": "",
+ "showpost.postedby": "Veröffentlicht von",
"showpost.postsearch.numofvotes": "{0} Stimmen",
"showpost.postsearch.query.placeholder": "Originalbeitrag suchen...",
"showpost.responseform.message.mergedvotes": "Stimmen aus diesem Beitrag werden mit den Stimmen vom ursprünglichen Beitrag zusammengeführt.",
"showpost.responseform.text.placeholder": "Was passiert in diesem Beitrag? Lass deine Benutzer wissen, was deine Pläne sind...",
- "showpost.save.success": "",
+ "showpost.save.success": "Beitrag erfolgreich aktualisiert",
"signin.code.edit": "Bearbeiten",
"signin.code.getnew": "Neuen Code anfordern",
- "signin.code.instruction": "Bitte geben Sie den soeben gesendeten Code an <0>{email}</0> ein.",
- "signin.code.placeholder": "Geben Sie hier den Code ein.",
- "signin.code.sent": "Ein neuer Code wurde an Ihre E-Mail-Adresse gesendet.",
+ "signin.code.instruction": "Bitte gib den soeben an <0>{email}</0> gesendeten Code ein.",
+ "signin.code.placeholder": "Gib hier den Code ein.",
+ "signin.code.sent": "Ein neuer Code wurde an deine E-Mail-Adresse gesendet.",
"signin.email.placeholder": "E-Mail-Adresse",
"signin.message.email": "Mit E-Mail fortfahren",
"signin.message.emaildisabled": "Die E-Mail-Authentifizierung wurde von einem Administrator deaktiviert. Wenn du ein Administrator-Konto hast und diese Einschränkung umgehen musst, klicke bitte <0>hier</0>.",
@@ -229,7 +232,7 @@
"signin.message.private.text": "Wenn du ein Konto oder eine Einladung hast, kannst du folgende Optionen nutzen, um dich anzumelden.",
"signin.message.private.title": "<0>{0}</0> ist ein privater Raum, du musst dich anmelden, um teilzunehmen und abstimmen zu können.",
"signin.message.socialbutton.intro": "Einloggen mit",
- "signin.name.placeholder": "Ihr Name",
+ "signin.name.placeholder": "Dein Name",
"validation.custom.maxattachments": "Es sind maximal {number} Anhänge zulässig.",
"validation.custom.maximagesize": "Die Bildgröße muss kleiner als {kilobytes}KB sein."
-}
\ No newline at end of file
+}
diff --git a/locale/el/client.json b/locale/el/client.json
index 6c954bd8f..e17b85fa7 100644
--- a/locale/el/client.json
+++ b/locale/el/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Άνοιγμα",
"enum.poststatus.planned": "Προγραμματισμένο",
"enum.poststatus.started": "Ξεκίνησε",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "Ο σύνδεσμος που κάνατε κλικ έχει λήξει.",
"error.expired.title": "Ληγμένο",
"error.forbidden.text": "Δεν έχετε δικαίωμα πρόσβασης σε αυτή τη σελίδα.",
diff --git a/locale/en/client.json b/locale/en/client.json
index 518853923..5a77ed622 100644
--- a/locale/en/client.json
+++ b/locale/en/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Open",
"enum.poststatus.planned": "Planned",
"enum.poststatus.started": "Started",
+ "error.accessdenied.contact": "If you believe this is an error, please contact your administrator.",
+ "error.accessdenied.text": "You do not have the required permissions to access this site.",
+ "error.accessdenied.title": "Access Denied",
"error.expired.text": "The link you clicked has expired.",
"error.expired.title": "Expired",
"error.forbidden.text": "You are not authorized to view this page.",
diff --git a/locale/es-ES/client.json b/locale/es-ES/client.json
index 5b8cbfb1a..7d48d5df6 100644
--- a/locale/es-ES/client.json
+++ b/locale/es-ES/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Abierto",
"enum.poststatus.planned": "Planificado",
"enum.poststatus.started": "Iniciado",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "El enlace en el que hizo clic ha expirado.",
"error.expired.title": "Caducado",
"error.forbidden.text": "No estás autorizado para ver esta página.",
diff --git a/locale/fa/client.json b/locale/fa/client.json
index 78a815877..367386a73 100644
--- a/locale/fa/client.json
+++ b/locale/fa/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "باز",
"enum.poststatus.planned": "برنامه‌ریزی شده",
"enum.poststatus.started": "شروع شده",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "لینکی که کلیک کردید منقضی شده است.",
"error.expired.title": "منقضی شده",
"error.forbidden.text": "شما اجازهٔ مشاهدهٔ این صفحه را ندارید.",
diff --git a/locale/fr/client.json b/locale/fr/client.json
index e1723a726..c7d00c16a 100644
--- a/locale/fr/client.json
+++ b/locale/fr/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Ouvert",
"enum.poststatus.planned": "Planifié",
"enum.poststatus.started": "Démarré",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "Le lien que vous avez cliqué a expiré.",
"error.expired.title": "Expiré",
"error.forbidden.text": "Vous n'êtes pas autorisé à accéder à cette page.",
diff --git a/locale/it/client.json b/locale/it/client.json
index ed92099a0..d6b51c2ab 100644
--- a/locale/it/client.json
+++ b/locale/it/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Aperto",
"enum.poststatus.planned": "Pianificato",
"enum.poststatus.started": "Iniziato",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "Il link che hai cliccato è scaduto.",
"error.expired.title": "Scaduto",
"error.forbidden.text": "Non sei autorizzato a visualizzare questa pagina.",
diff --git a/locale/ja/client.json b/locale/ja/client.json
index 7b4e04dbf..04408a57d 100644
--- a/locale/ja/client.json
+++ b/locale/ja/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "開く",
"enum.poststatus.planned": "準備中",
"enum.poststatus.started": "開始済み",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "クリックしたリンクは期限切れです。",
"error.expired.title": "期限切れ",
"error.forbidden.text": "このページを閲覧する権限がありません。",
diff --git a/locale/nl/client.json b/locale/nl/client.json
index 7b780c6fe..692fc7dae 100644
--- a/locale/nl/client.json
+++ b/locale/nl/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Open",
"enum.poststatus.planned": "Gepland",
"enum.poststatus.started": "Gestart",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "De link waarop je hebt geklikt is verlopen.",
"error.expired.title": "Verlopen",
"error.forbidden.text": "Je bent niet gemachtigd om deze pagina te openen.",
diff --git a/locale/pl/client.json b/locale/pl/client.json
index bf8e5e2e9..696062207 100644
--- a/locale/pl/client.json
+++ b/locale/pl/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Otwarte",
"enum.poststatus.planned": "Zaplanowane",
"enum.poststatus.started": "Rozpoczęte",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "Kliknięty przez Ciebie link wygasł.",
"error.expired.title": "Wygasły",
"error.forbidden.text": "Nie masz uprawnień do wyświetlania tej strony.",
diff --git a/locale/pt-BR/client.json b/locale/pt-BR/client.json
index 0e7feb022..2877b9950 100644
--- a/locale/pt-BR/client.json
+++ b/locale/pt-BR/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Aberto",
"enum.poststatus.planned": "Planejado",
"enum.poststatus.started": "Iniciado",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "O link que você acessou expirou.",
"error.expired.title": "Expirado",
"error.forbidden.text": "Você não está autorizado a visualizar esta página.",
diff --git a/locale/ru/client.json b/locale/ru/client.json
index 6dbb12b8b..f033439b6 100644
--- a/locale/ru/client.json
+++ b/locale/ru/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Открыто",
"enum.poststatus.planned": "Запланировано",
"enum.poststatus.started": "Начато",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "Срок действия ссылки, по которой вы перешли, истёк.",
"error.expired.title": "Срок действия истёк",
"error.forbidden.text": "Вы не можете просматривать эту страницу.",
diff --git a/locale/sk/client.json b/locale/sk/client.json
index 4bc6cd851..eac28dcc2 100644
--- a/locale/sk/client.json
+++ b/locale/sk/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Otvorené",
"enum.poststatus.planned": "Plánované",
"enum.poststatus.started": "Začaté",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "Platnosť odkazu, na ktorý ste klikli, vypršala.",
"error.expired.title": "Platnosť vypršala",
"error.forbidden.text": "Nemáte oprávnenie na zobrazenie tejto stránky.",
diff --git a/locale/sv-SE/client.json b/locale/sv-SE/client.json
index 994f09ed4..91b6dd342 100644
--- a/locale/sv-SE/client.json
+++ b/locale/sv-SE/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Öppen",
"enum.poststatus.planned": "Planerad",
"enum.poststatus.started": "Startad",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "Länken du klickade på har gått ut.",
"error.expired.title": "Utgången",
"error.forbidden.text": "Du har inte behörighet att se den här sidan.",
diff --git a/locale/tr/client.json b/locale/tr/client.json
index 09414eed9..bd9ea6944 100644
--- a/locale/tr/client.json
+++ b/locale/tr/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "Açık",
"enum.poststatus.planned": "Planlandı",
"enum.poststatus.started": "Başlatıldı",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "Tıkladığınız bağlantının süresi doldu.",
"error.expired.title": "Süresi Bitmiş",
"error.forbidden.text": "Bu sayfayı görüntülemek için yetkiniz yok.",
diff --git a/locale/zh-CN/client.json b/locale/zh-CN/client.json
index 05ad3059f..8bb9dae19 100644
--- a/locale/zh-CN/client.json
+++ b/locale/zh-CN/client.json
@@ -30,6 +30,9 @@
"enum.poststatus.open": "开启",
"enum.poststatus.planned": "计划中",
"enum.poststatus.started": "进行中",
+ "error.accessdenied.contact": "",
+ "error.accessdenied.text": "",
+ "error.accessdenied.title": "",
"error.expired.text": "您点击的链接已过期.",
"error.expired.title": "过期",
"error.forbidden.text": "您无权查看此页面.",
diff --git a/migrations/202602251400_add_oauth_roles_path.sql b/migrations/202602251400_add_oauth_roles_path.sql
new file mode 100644
index 000000000..f21ce4ade
--- /dev/null
+++ b/migrations/202602251400_add_oauth_roles_path.sql
@@ -0,0 +1,2 @@
+ALTER TABLE oauth_providers ADD COLUMN json_user_roles_path TEXT;
+
diff --git a/public/models/settings.ts b/public/models/settings.ts
index 98c129440..507cb250e 100644
--- a/public/models/settings.ts
+++ b/public/models/settings.ts
@@ -47,6 +47,7 @@ export interface OAuthConfig {
jsonUserIDPath: string
jsonUserNamePath: string
jsonUserEmailPath: string
+ jsonUserRolesPath: string
isTrusted: boolean
}
diff --git a/public/pages/Administration/components/OAuthForm.tsx b/public/pages/Administration/components/OAuthForm.tsx
index e08b8bd5f..128ff3062 100644
--- a/public/pages/Administration/components/OAuthForm.tsx
+++ b/public/pages/Administration/components/OAuthForm.tsx
@@ -27,6 +27,7 @@ export const OAuthForm: React.FC<OAuthFormProps> = (props) => {
const [jsonUserIDPath, setJSONUserIDPath] = useState((props.config && props.config.jsonUserIDPath) || "")
const [jsonUserNamePath, setJSONUserNamePath] = useState((props.config && props.config.jsonUserNamePath) || "")
const [jsonUserEmailPath, setJSONUserEmailPath] = useState((props.config && props.config.jsonUserEmailPath) || "")
+ const [jsonUserRolesPath, setJSONUserRolesPath] = useState((props.config && props.config.jsonUserRolesPath) || "")
const [logo, setLogo] = useState<ImageUpload | undefined>()
const [logoURL, setLogoURL] = useState<string | undefined>()
const [logoBlobKey, setLogoBlobKey] = useState((props.config && props.config.logoBlobKey) || "")
@@ -47,6 +48,7 @@ export const OAuthForm: React.FC<OAuthFormProps> = (props) => {
jsonUserIDPath,
jsonUserNamePath,
jsonUserEmailPath,
+ jsonUserRolesPath,
logo,
})
if (result.ok) {
@@ -157,7 +159,7 @@ export const OAuthForm: React.FC<OAuthFormProps> = (props) => {
.
</p>
- <div className="grid grid-cols-3 gap-4">
+ <div className="grid grid-cols-4 gap-4">
<Input
field="jsonUserIDPath"
label="ID"
@@ -192,6 +194,16 @@ export const OAuthForm: React.FC<OAuthFormProps> = (props) => {
Optional, but <strong>highly</strong> recommended.
</p>
</Input>
+ <Input
+ field="jsonUserRolesPath"
+ label="Roles"
+ maxLength={100}
+ value={jsonUserRolesPath}
+ disabled={!fider.session.user.isAdministrator}
+ onChange={setJSONUserRolesPath}
+ >
+ <p className="text-muted">Optional. Used for role-based access control.</p>
+ </Input>
</div>
<Field label="Trusted Source">
diff --git a/public/pages/Error/AccessDenied.page.tsx b/public/pages/Error/AccessDenied.page.tsx
new file mode 100644
index 000000000..320844942
--- /dev/null
+++ b/public/pages/Error/AccessDenied.page.tsx
@@ -0,0 +1,19 @@
+import { Trans } from "@lingui/react/macro"
+import React from "react"
+import { ErrorPageWrapper } from "./components/ErrorPageWrapper"
+
+export const AccessDenied = () => {
+ return (
+ <ErrorPageWrapper id="p-access-denied" showHomeLink={true}>
+ <h1 className="text-display">
+ <Trans id="error.accessdenied.title">Access Denied</Trans>
+ </h1>
+ <p>
+ <Trans id="error.accessdenied.text">You do not have the required permissions to access this site.</Trans>
+ </p>
+ <p className="text-muted">
+ <Trans id="error.accessdenied.contact">If you believe this is an error, please contact your administrator.</Trans>
+ </p>
+ </ErrorPageWrapper>
+ )
+}
diff --git a/public/pages/OAuthEcho/OAuthEcho.page.tsx b/public/pages/OAuthEcho/OAuthEcho.page.tsx
index 8ada76f11..b835f438f 100644
--- a/public/pages/OAuthEcho/OAuthEcho.page.tsx
+++ b/public/pages/OAuthEcho/OAuthEcho.page.tsx
@@ -14,6 +14,7 @@ interface OAuthEchoPageProps {
id: string
name: string
email: string
+ roles: string[]
}
}
@@ -39,6 +40,7 @@ export default class OAuthEchoPage extends React.Component<OAuthEchoPageProps, a
const idOk = this.props.profile && this.props.profile.id !== ""
const nameOk = this.props.profile && this.props.profile.name !== "Anonymous"
const emailOk = this.props.profile && this.props.profile.email !== ""
+ const hasRoles = this.props.profile && this.props.profile.roles && this.props.profile.roles.length > 0
let responseBody = ""
try {
@@ -82,6 +84,13 @@ export default class OAuthEchoPage extends React.Component<OAuthEchoPageProps, a
</span>
)}
</VStack>
+ <VStack>
+ <HStack>
+ {hasRoles ? ok : warn}
+ <strong>Roles:</strong> {hasRoles ? this.props.profile.roles.join(", ") : "(none)"}
+ </HStack>
+ <span className="text-muted">Roles are optional and used for role-based access control when OAUTH_ALLOWED_ROLES is configured.</span>
+ </VStack>
</VStack>
</>
)
diff --git a/public/services/actions/tenant.ts b/public/services/actions/tenant.ts
index 546db011d..fd2ecd135 100644
--- a/public/services/actions/tenant.ts
+++ b/public/services/actions/tenant.ts
@@ -118,6 +118,7 @@ export interface CreateEditOAuthConfigRequest {
jsonUserIDPath: string
jsonUserNamePath: string
jsonUserEmailPath: string
+ jsonUserRolesPath: string
logo?: ImageUpload
isTrusted: boolean
}