コード例 #1
0
        private void SetFieldLevel(FieldInfo field)
        {
            var             fieldName    = field.Name;
            var             indexingInfo = field.IndexingInfo;
            QueryFieldLevel level;

            if (fieldName == LucObject.FieldName.AllText)
            {
                level = QueryFieldLevel.BinaryOrFullText;
            }
            else if (indexingInfo == null)
            {
                level = QueryFieldLevel.BinaryOrFullText;
            }
            else if (indexingInfo.FieldDataType == typeof(SenseNet.ContentRepository.Storage.BinaryData))
            {
                level = QueryFieldLevel.BinaryOrFullText;
            }
            else if (fieldName == LucObject.FieldName.InFolder || fieldName == LucObject.FieldName.InTree ||
                     fieldName == LucObject.FieldName.Type || fieldName == LucObject.FieldName.TypeIs ||
                     _headOnlyFields.Contains(fieldName))
            {
                level = QueryFieldLevel.HeadOnly;
            }
            else
            {
                level = QueryFieldLevel.NoBinaryOrFullText;
            }

            FieldLevel = (QueryFieldLevel)(Math.Max((int)level, (int)FieldLevel));
        }
コード例 #2
0
 public PermissionFilter(SnQuery query, IQueryContext context)
 {
     _userId          = context.UserId;
     _user            = Node.LoadNode(_userId) as IUser;
     _queryFieldLevel = GetFieldLevel(query);
     _allVersions     = query.AllVersions;
 }
コード例 #3
0
 public PermissionFilter(IUser user, QueryFieldLevel queryFieldLevel, bool allVersions)
 {
     _userId          = user.Id;
     _user            = user;
     _queryFieldLevel = queryFieldLevel;
     _allVersions     = allVersions;
 }
コード例 #4
0
ファイル: LucQuery.cs プロジェクト: vlslavik/SenseNet
        internal static LucQuery Create(Query luceneQuery, QueryFieldLevel level)
        {
            var query = new LucQuery {
                Query = luceneQuery
            };

            query.TraceInfo.InputText = "";
            query.FieldLevel          = level;
            return(query);
        }
コード例 #5
0
        private Query ParseTermExp()
        {
            //TermExp           ==>  UnaryTermExp | BinaryTermExp | QueryExpGroup | DefaultFieldExp

            Query result = null;

            var fieldInfo = ParseFieldHead();

            if (fieldInfo != null)
            {
                _currentField.Push(fieldInfo);
            }
            else if (_currentField.Count != 0)
            {
                _currentField.Push(_currentField.Peek());
            }
            else
            {
                _currentField.Push(FieldInfo.Default);
                FieldLevel = QueryFieldLevel.BinaryOrFullText;
            }
            result = ParseUnaryTermExp();
            if (result != null)
            {
                _currentField.Pop();
                return(result);
            }
            result = ParseBinaryTermExp();
            if (result != null)
            {
                _currentField.Pop();
                return(result);
            }
            result = ParseQueryExpGroup();
            if (result != null)
            {
                _currentField.Pop();
                return(result);
            }
            result = ParseDefaultFieldExp();
            if (result != null)
            {
                _currentField.Pop();
                return(result);
            }
            throw ParserError("Expected field expression, expression group or simple term.");
        }
コード例 #6
0
ファイル: PermissionChecker.cs プロジェクト: sztomi/sensenet
 public PermissionChecker(IUser user, QueryFieldLevel queryFieldLevel, bool allVersions)
 {
     _user            = user;
     _queryFieldLevel = queryFieldLevel;
     _allVersions     = allVersions;
 }
コード例 #7
0
 public ServicePermissionFilter(SecurityHandler security, QueryFieldLevel queryFieldLevel, bool allVersions)
 {
     _security        = security;
     _allVersions     = allVersions;
     _queryFieldLevel = queryFieldLevel;
 }