Free and obstructed glide of dislocations: A theoretical framework