예제 #1
0
        IEnumerable <object> GetRoles(IUserWithRoles userWithRoles)
        {
            IEnumerable <object> roles = null;

            if (userWithRoles != null)
            {
                roles = userWithRoles.Roles.OfType <XPBaseObject>().Select(role => role.ClassInfo.KeyProperty.GetValue(role));
            }
            if (roles == null)
            {
                var securityUserWithRoles = SecuritySystem.CurrentUser as ISecurityUserWithRoles;
                if (securityUserWithRoles != null)
                {
                    roles = securityUserWithRoles.Roles.OfType <XPBaseObject>().Select(role => role.ClassInfo.KeyProperty.GetValue(role));
                }
            }
            return(roles);
        }
예제 #2
0
        static IEnumerable <object> Collection(IUserWithRoles userWithRoles)
        {
            IEnumerable <object> collection = null;

            if (userWithRoles != null)
            {
                collection = userWithRoles.Roles.OfType <XPBaseObject>().Select(role => role.ClassInfo.KeyProperty.GetValue(role));
            }
            if (collection == null)
            {
                var securityUserWithRoles = SecuritySystem.CurrentUser as ISecurityUserWithRoles;
                if (securityUserWithRoles != null)
                {
                    collection =
                        securityUserWithRoles.Roles.OfType <XPBaseObject>()
                        .Select(role => role.ClassInfo.KeyProperty.GetValue(role));
                }
            }
            return(collection);
        }