Beispiel #1
0
        public bool CanProceed(Modules module, Actions eventType)
        {
            bool result = false;

            switch (eventType)
            {
            case Actions.Edit:
                if (!PermissionBS.HasFullAccess(Session.Instance.AuthUser.UserId, (int)module) ||
                    !PermissionBS.HasAccessToEdit(Session.Instance.AuthUser.UserId, (int)module))
                {
                    MessageBox.Show("User doesn't have access to edit this module.");
                    result = false;
                }
                else
                {
                    result = true;
                }
                break;

            case Actions.Read:
                if (!PermissionBS.HasFullAccess(Session.Instance.AuthUser.UserId, (int)module) ||
                    !PermissionBS.HasAccessToRead(Session.Instance.AuthUser.UserId, (int)module))
                {
                    MessageBox.Show("User doesn't have access to view this module.");
                    result = false;
                }
                else
                {
                    result = true;
                }
                break;
            }

            return(result);
        }
 private void button_Organization_Click(object sender, EventArgs e)
 {
     if (PermissionBS.HasFullAccess(Session.Instance.AuthUser.UserId, (int)Modules.Company) ||
         PermissionBS.HasAccessToRead(Session.Instance.AuthUser.UserId, (int)Modules.Company))
     {
         PopulateOrganization();
     }
     else
     {
         MessageBox.Show("User doesn't have access to this module.");
     }
 }