Project

General

Profile

« Previous | Next » 

Revision 7681

Added by Jing Tao over 11 years ago

Fixed a bug to put "OR" correctly in the query.
And remove the user "authorized_user" from the rightsholder clause in the query.

View differences:

src/edu/ucsb/nceas/metacat/index/MetacatSolrIndex.java
296 296
    
297 297
    private StringBuffer generateAccessFilterParamsString(Set<Subject>subjects) {
298 298
        StringBuffer query = new StringBuffer();
299
        boolean first = true;
299 300
        if(subjects != null) {
300 301
            for(Subject subject : subjects) {
301 302
                if(subject != null) {
302 303
                    String subjectName = subject.getValue();
303 304
                    if(subjectName != null && !subjectName.trim().equals("")) {
304
                        boolean first = true;
305 305
                        if(first) {
306 306
                            first = false;
307 307
                            query.append(OPENPARENTHESE+READPERMISSION+COLON+"\""+subjectName+"\""+CLOSEPARENTHESE);
308
                            if(!subjectName.equals(Constants.SUBJECT_PUBLIC)) {
308
                            if(!subjectName.equals(Constants.SUBJECT_PUBLIC) && !subjectName.equals(Constants.SUBJECT_AUTHENTICATED_USER)) {
309 309
                                query.append(OR+OPENPARENTHESE+RIGHTSHOLDER+COLON+"\""+subjectName+"\""+CLOSEPARENTHESE);
310 310
                            }
311 311
                        } else {
312 312
                            query.append(OR + OPENPARENTHESE+READPERMISSION+COLON+"\""+subjectName+"\""+CLOSEPARENTHESE);
313
                            if(!subjectName.equals(Constants.SUBJECT_PUBLIC)) {
313
                            if(!subjectName.equals(Constants.SUBJECT_PUBLIC) && !subjectName.equals(Constants.SUBJECT_AUTHENTICATED_USER)) {
314 314
                                query.append(OR + OPENPARENTHESE+RIGHTSHOLDER+COLON+"\""+subjectName+"\""+CLOSEPARENTHESE);
315 315
                            }
316 316
                        }

Also available in: Unified diff