def update_forum_role(course_id, user, rolename, action):
 role = Role.objects.get(course_id=course_id, name=rolename)
 if (action == 'allow'):
  role.users.add(user)
 elif (action == 'revoke'):
  role.users.remove(user)
 else:
  raise ValueError("unrecognized action '{}'".format(action))

def update_forum_role ( course_id , user , rolename , action ) : role = Role . objects . get ( course_id = course_id , name = rolename ) if ( action == 'allow' ) : role . users . add ( user ) elif ( action == 'revoke' ) : role . users . remove ( user ) else : raise ValueError ( "unrecognized action '{}'" . format ( action ) )
change forum access of user .