當前位置: 首頁>>代碼示例>>Java>>正文


Java VisibilityFilter類代碼示例

本文整理匯總了Java中org.entcore.common.service.VisibilityFilter的典型用法代碼示例。如果您正苦於以下問題:Java VisibilityFilter類的具體用法?Java VisibilityFilter怎麽用?Java VisibilityFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


VisibilityFilter類屬於org.entcore.common.service包,在下文中一共展示了VisibilityFilter類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: authorize

import org.entcore.common.service.VisibilityFilter; //導入依賴的package包/類
@Override
public void authorize(HttpServerRequest request, Binding binding, UserInfos user, Handler<Boolean> handler) {
	String sharedMethod = binding.getServiceMethod().replaceAll("\\.", "-");
	String id = request.params().get(conf.getResourceIdLabel());
	if (id != null && !id.trim().isEmpty()) {
		List<DBObject> groups = new ArrayList<>();
		groups.add(QueryBuilder.start("userId").is(user.getUserId())
				.put(sharedMethod).is(true).get());
		for (String gpId: user.getGroupsIds()) {
			groups.add(QueryBuilder.start("groupId").is(gpId)
					.put(sharedMethod).is(true).get());
		}
		QueryBuilder query = QueryBuilder.start("_id").is(id).or(
				QueryBuilder.start("owner.userId").is(user.getUserId()).get(),
				QueryBuilder.start("visibility").is(VisibilityFilter.PUBLIC.name()).get(),
				QueryBuilder.start("visibility").is(VisibilityFilter.PROTECTED.name()).get(),
				QueryBuilder.start("shared").elemMatch(
						new QueryBuilder().or(groups.toArray(new DBObject[groups.size()])).get()).get()
		);
		MongoAppFilter.executeCountQuery(request, conf.getCollection(),
				MongoQueryBuilder.build(query), 1, handler);
	} else {
		handler.handle(false);
	}
}
 
開發者ID:OPEN-ENT-NG,項目名稱:community,代碼行數:26,代碼來源:PageReadFilter.java

示例2: retrieves

import org.entcore.common.service.VisibilityFilter; //導入依賴的package包/類
public void retrieves(List<String> ids, final JsonObject projection, UserInfos user, Handler<Either<String, JsonArray>> handler) {
	QueryBuilder builder = QueryBuilder.start("_id").in(new HashSet<String>(ids));
	if (user == null) {
		builder.put("visibility").is(VisibilityFilter.PUBLIC.name());
	}
	mongo.find(ShareBigFiles.SHARE_BIG_FILE_COLLECTION, MongoQueryBuilder.build(builder),
			null, projection, validResultsHandler(handler));
}
 
開發者ID:OPEN-ENT-NG,項目名稱:share-big-files,代碼行數:9,代碼來源:ShareBigFilesServiceImpl.java

示例3: list

import org.entcore.common.service.VisibilityFilter; //導入依賴的package包/類
/**
 * Lists every object associated with the user.
 * @param request Client request.
 */
@Get("/list")
@SecuredAction(value = read_only, type = ActionType.AUTHENTICATED)
public void list(final HttpServerRequest request) {
	UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
		@Override
		public void handle(final UserInfos user) {
			String filter = request.params().get("filter");
			VisibilityFilter v = VisibilityFilter.ALL;
			if (filter != null) {
				try {
					v = VisibilityFilter.valueOf(filter.toUpperCase());
				} catch (IllegalArgumentException | NullPointerException e) {
					v = VisibilityFilter.ALL;
					if (log.isDebugEnabled()) {
						log.debug("Invalid filter " + filter);
					}
				}
			}

			shareBigFileCrudService.list(v, user, new Handler<Either<String, JsonArray>>() {
				@Override
				public void handle(Either<String, JsonArray> event) {
					if (event.isRight()) {
						Renders.renderJson(request, event.right().getValue());
					} else {
						leftToResponse(request, event.left());
					}
				}

			});
		}
	});
}
 
開發者ID:OPEN-ENT-NG,項目名稱:share-big-files,代碼行數:38,代碼來源:ShareBigFilesController.java


注:本文中的org.entcore.common.service.VisibilityFilter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。