File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
src/main/java/net/dirtydeeds/discordsoundboard/util Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change 1- projectVersion =4.1.47
1+ projectVersion =4.1.48
22org.gradle.configuration-cache =false
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ public class UserRoleConfig {
4848 /**
4949 * Get roles for a specific user
5050 * Database roles take precedence over configuration file roles
51+ * Default "user" role is only assigned to authenticated users (non-null/non-empty userId)
5152 */
5253 public List <String > getUserRoles (String userId ) {
5354 List <String > returnRoles = new ArrayList <>();
@@ -77,6 +78,12 @@ public List<String> getUserRoles(String userId) {
7778 // 3. Fallback to YAML roles map
7879 returnRoles .addAll (roles .getOrDefault (userId , new ArrayList <>()));
7980
81+ // If the user is not authenticated then return the configured roles. This is intended to just skip the defaulting
82+ // of the "user" role.
83+ if (userId == null || userId .isEmpty ()) {
84+ return returnRoles ;
85+ }
86+
8087 // 4. If no roles assigned, give default "user" role
8188 if (returnRoles .isEmpty ()) {
8289 returnRoles .add ("user" );
You can’t perform that action at this time.
0 commit comments