In today's world, services are improved and advanced in every field of life. Especially in the health sector, information technology (IT) plays a vigorous role in electronic health (e-health). To achieve benefits from e-health, its cloud-based implementation is necessary. With this environment's multiple benefits, privacy and security loopholes exist. As the number of users grows, the Electronic Healthcare System's (EHS) response time becomes slower. This study presented a trust mechanism for access control (AC) known as role-based access control (RBAC) to address this issue. This method observes the user's behavior and assigns roles based on it. The AC module has been implemented using SQL Server, and an administrator develops controls for users with roles and access to multiple EHS modules. To validate the user's trust value, A .net-based framework has been introduced. The framework of e-health proposed in this research ensures that users can protect their data from intruders and other security threats.