When personal violence is offered by a inmate to an officer, employee or to another inmate, or when an attempt is made to escape, or to do injury to the building, or any material, implements, etc., those officers and employees are authorized to use all necessary means of defense and to secure the person of the offender.