A Flexible Solution for Privilege Management and Access Control in EHR Systems