public ActionResult Kullanici(int id)
        {
            var value = _firmalarService.GetByID(id);

            if (value == null)
            {
                return(Ok(new { Error = "Data not found." }));
            }
            return(Ok(value));
        }
Пример #2
0
        // Kullanıcının rolüne uygun bir şekilde kullanıcı yetki listesi döndürür.
        public List <KullaniciYetkiler> RolBazliKullaniciYetkiListesi(int IlgiliID)
        {
            var kullaniciYetkiler     = new List <KullaniciYetkiler>();
            var ilgiliKullaniciBulucu = _firmalarService.GetByID(IlgiliID);

            if (ilgiliKullaniciBulucu != null)
            {
                if (ilgiliKullaniciBulucu.Aktif == true)
                {
                    if (_userJWTInfo.GetInfo().role == Role.Admin)
                    {
                        kullaniciYetkiler = _kullaniciYetkilerService.GetAll(a => a.Aktif == true && a.IlgiliID == IlgiliID && a.ListeAktiflik == true && a.YetkiTip == ilgiliKullaniciBulucu.Rol).ToList();
                    }
                    else if (_userJWTInfo.GetInfo().role == Role.IsletmeKullanicisi)
                    {
                        kullaniciYetkiler = _kullaniciYetkilerService.GetAll(a => a.Aktif == true && a.IlgiliID == IlgiliID && a.ListeAktiflik == true && a.YetkiTip == ilgiliKullaniciBulucu.Rol).ToList();
                    }
                    else if (_userJWTInfo.GetInfo().role == Role.FirmaKullanicisi)
                    {
                        kullaniciYetkiler = _kullaniciYetkilerService.GetAll(a => a.Aktif == true && a.IlgiliID == IlgiliID && a.ListeAktiflik == true && a.YetkiTip == ilgiliKullaniciBulucu.Rol).ToList();
                    }
                    else if (_userJWTInfo.GetInfo().role == Role.SubeKullanicisi)
                    {
                        kullaniciYetkiler = _kullaniciYetkilerService.GetAll(a => a.Aktif == true && a.IlgiliID == IlgiliID && a.ListeAktiflik == true && a.YetkiTip == ilgiliKullaniciBulucu.Rol).ToList();
                    }
                }
            }
            kullaniciYetkiler = kullaniciYetkiler.Distinct().ToList();
            return(kullaniciYetkiler);
        }