The governing authorities of municipalities shall have the power to compel owners of property adjacent to walks and ways to erect and maintain railings, safeguards, and barriers along the same in all cases where construction, repair, or other building activities on such premises create a dangerous or hazardous condition, and in all other cases where danger or hazard is created by the act of the property owner.