Exemplo n.º 1
0
        /// ////////////////////////////////////////////////////
        private bool ShouldAffiche(CMenuCustom menu)
        {
            bool bAfficheGroupes = false;
            bool bAfficheProfils = false;
            bool bAffiche        = true;

            CDbKey[] keysGroupes = menu.KeysGroupes;
            if (keysGroupes != null && keysGroupes.Length > 0)
            {
                bAffiche = false;
                //TESTDBKEYOK
                CDbKey[] lstGroupesSession = CTimosApp.SessionClient.GetInfoUtilisateur().ListeKeysGroupes;
                foreach (CDbKey keyVoyant in keysGroupes)
                {
                    foreach (CDbKey key in lstGroupesSession)
                    {
                        if (keyVoyant == key)
                        {
                            bAfficheGroupes = true;
                        }
                    }
                }
            }

            //TESTDBKEYOK
            CDbKey[] keysProfils = menu.KeysProfils;
            if (keysProfils != null && keysProfils.Length > 0)
            {
                bAffiche = false;
                CDonneesActeurUtilisateur user = CDonneesActeurUtilisateur.GetUserForSession(
                    CTimosApp.SessionClient.IdSession,
                    m_menuCustom.ContexteDonnee);
                foreach (CDbKey keyVoyant in keysProfils)
                {
                    CProfilUtilisateur profilVoyant = new CProfilUtilisateur(m_menuCustom.ContexteDonnee);
                    if (profilVoyant.ReadIfExists(keyVoyant))
                    {
                        if (user.IsInProfil(profilVoyant))
                        {
                            bAfficheGroupes = true;
                        }
                    }
                }
            }

            if (!bAffiche)
            {
                return(bAfficheGroupes || bAfficheProfils);
            }

            return(bAffiche);
        }