I tried deleted role of a user via SQL query
delete from scada_user_rl where user_id =
( select id from scada_users where primaryEmail =:email )
but that did not work. I can add roles to a user using SQL query but cannot delete it.
Is it possible to delete it via scripts? If so, how would you go about doing that?
             
            
              
              
              
            
            
           
          
            
            
              This is entirely untested, but it looks like you can get a User object with:
system.user.getUser(userSource,username)
Then from looking at this link you should be able to use this on that user object
removeRole('role')
so something like:
userToEdit = system.user.getUser(userSource,"username")
userToEdit.removeRole("role")
             
            
              
              
              1 Like
            
            
           
          
            
            
              You’d also need to save the user afterwards.
             
            
              
              
              1 Like
            
            
           
          
            
            
              Then as Kathy says, save it!
 system.user.editUser(userSource, userToEdit)
             
            
              
              
              2 Likes
            
            
           
          
            
            
              This works for any user?
I can call any user and remove roles assigned to them