mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-11-04 03:17:00 -05:00 
			
		
		
		
	Merge pull request #3368 from nichwall/fix_tag_permissions
Fix tag permissions
This commit is contained in:
		
						commit
						f194c5be0e
					
				@ -270,8 +270,10 @@ class UserController {
 | 
				
			|||||||
      const permissions = {
 | 
					      const permissions = {
 | 
				
			||||||
        ...user.permissions
 | 
					        ...user.permissions
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      const defaultPermissions = Database.userModel.getDefaultPermissionsForUserType(updatePayload.type || user.type || 'user')
 | 
				
			||||||
      for (const key in updatePayload.permissions) {
 | 
					      for (const key in updatePayload.permissions) {
 | 
				
			||||||
        if (permissions[key] !== undefined) {
 | 
					        // Check that the key is a valid permission key or is included in the default permissions
 | 
				
			||||||
 | 
					        if (permissions[key] !== undefined || defaultPermissions[key] !== undefined) {
 | 
				
			||||||
          if (typeof updatePayload.permissions[key] !== 'boolean') {
 | 
					          if (typeof updatePayload.permissions[key] !== 'boolean') {
 | 
				
			||||||
            Logger.warn(`[UserController] update: Invalid permission value for key ${key}. Should be boolean`)
 | 
					            Logger.warn(`[UserController] update: Invalid permission value for key ${key}. Should be boolean`)
 | 
				
			||||||
          } else if (permissions[key] !== updatePayload.permissions[key]) {
 | 
					          } else if (permissions[key] !== updatePayload.permissions[key]) {
 | 
				
			||||||
 | 
				
			|||||||
@ -108,6 +108,7 @@ class User extends Model {
 | 
				
			|||||||
      accessAllLibraries: true,
 | 
					      accessAllLibraries: true,
 | 
				
			||||||
      accessAllTags: true,
 | 
					      accessAllTags: true,
 | 
				
			||||||
      accessExplicitContent: true,
 | 
					      accessExplicitContent: true,
 | 
				
			||||||
 | 
					      selectedTagsNotAccessible: false,
 | 
				
			||||||
      librariesAccessible: [],
 | 
					      librariesAccessible: [],
 | 
				
			||||||
      itemTagsSelected: []
 | 
					      itemTagsSelected: []
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user