Beispiel #1
0
        public List<Role> GetRoles(Guid accountId)
        {
            List<Role> result = new List<Role>();
            SecurityDataContext context = new SecurityDataContext();

            var refRoles = context.References.Where(x => x.ReferenceTypeCode == "Role").ToList();

            var roles =
                from a in context.AccountHasRoles.Where(x => x.AccountId == accountId)
                select new Role()
                {
                    Code = a.RoleCode,

                };

            foreach(Role role in roles)
            {
                Privileges privilege = new Privileges();
                privilege.AddRange(GetPrivileges(role.Code));

                role.Privileges = privilege;
                result.Add(role);
            }
            return result.ToList();
        }