Ejemplo n.º 1
0
        public DataAccessPermissions ToPermissionsModel()
        {
            var attributes = LegalUnit
                             .Concat(LocalUnit)
                             .Concat(EnterpriseUnit)
                             .Concat(EnterpriseGroup)
                             .ToList();

            return(new DataAccessPermissions(Mapper.Map <List <Permission> >(attributes)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Convert method to string collection
        /// </summary>
        /// <param name="validate">Flag of validity</param>
        /// <returns></returns>
        public IEnumerable <string> ToStringCollection(bool validate = true)
        {
            var attributes = LegalUnit.Concat(LocalUnit)
                             .Concat(EnterpriseUnit)
                             .Concat(EnterpriseGroup)
                             .Where(v => v.Allowed)
                             .Select(v => v.Name);

            if (validate)
            {
                attributes = attributes.Where(v => DataAccessAttributesProvider.Find(v) != null);
            }
            return(attributes);
        }