本文整理汇总了Java中fr.wseduc.security.ActionType.RESOURCE属性的典型用法代码示例。如果您正苦于以下问题:Java ActionType.RESOURCE属性的具体用法?Java ActionType.RESOURCE怎么用?Java ActionType.RESOURCE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类fr.wseduc.security.ActionType
的用法示例。
在下文中一共展示了ActionType.RESOURCE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePending
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/:"+Actualites.INFO_RESOURCE_ID+"/pending")
@ApiDoc("Update : update an Info in Draft state in thread by thread and by id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.publish", type = ActionType.RESOURCE)
public void updatePending(final HttpServerRequest request) {
final String infoId = request.params().get(Actualites.INFO_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_INFO_UPDATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
resource.putNumber("status", status_list.get(2));
if(!resource.containsField("expiration_date")){
resource.putString("expiration_date", null);
}
if(!resource.containsField("publication_date")){
resource.putString("publication_date", null);
}
notifyOwner(request, user, resource, infoId, NEWS_UPDATE_EVENT_TYPE);
infoService.update(infoId, resource, user, Events.PENDING.toString(), notEmptyResponseHandler(request));
}
});
}
});
}
示例2: listUsers
@Get("/:id/users")
@SecuredAction(value = "", type = ActionType.RESOURCE)
public void listUsers(final HttpServerRequest request) {
List<String> t = request.params().getAll("type");
JsonArray types = (t != null && !t.isEmpty()) ?
new JsonArray(t.toArray()) : resourcesTypes; //new JsonArray(RightsController.allowedSharingRights.toArray());
communityService.listUsers(request.params().get("id"), types, new Handler<Either<String, JsonObject>>() {
@Override
public void handle(final Either<String, JsonObject> event) {
final Handler<Either<String, JsonObject>> handler = defaultResponseHandler(request);
if (event.isRight()) {
final JsonObject res = event.right().getValue();
listVisible(request, I18n.acceptLanguage(request), new Handler<JsonObject>() {
@Override
public void handle(final JsonObject visibles) {
res.putObject("visibles", visibles);
handler.handle(event);
}
});
} else {
handler.handle(event);
}
}
});
}
示例3: updateResourceType
@Put("/type/:id")
@ApiDoc("Update resource type")
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void updateResourceType(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
RequestUtils.bodyToJson(request, pathPrefix + "updateResourceType", new Handler<JsonObject>() {
@Override
public void handle(JsonObject object) {
String id = request.params().get("id");
crudService.update(id, object, user, defaultResponseHandler(request));
}
});
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例4: deleteResourceType
@Delete("/type/:id")
@ApiDoc("Delete resource type")
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void deleteResourceType(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
String id = request.params().get("id");
crudService.delete(id, user, defaultResponseHandler(request, 204));
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例5: createPeriodicBooking
@Post("/resource/:id/booking/periodic")
@ApiDoc("Create periodic booking of a given resource")
@SecuredAction(value = "rbs.contrib", type= ActionType.RESOURCE)
@ResourceFilter(TypeAndResourceAppendPolicy.class)
public void createPeriodicBooking(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
RequestUtils.bodyToJson(request, pathPrefix + "createPeriodicBooking",
getPeriodicBookingHandler(user, request, true));
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例6: updatePeriodicBooking
@Put("/resource/:id/booking/:bookingId/periodic")
@ApiDoc("Update periodic booking")
@SecuredAction(value = "rbs.contrib", type= ActionType.RESOURCE)
@ResourceFilter(TypeAndResourceAppendPolicy.class)
public void updatePeriodicBooking(final HttpServerRequest request){
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
RequestUtils.bodyToJson(request, pathPrefix + "updatePeriodicBooking",
getPeriodicBookingHandler(user, request, false));
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例7: update
/**
* Updates a single generic_app.
* @param request Client request.
*/
@Put("/:id")
@SecuredAction(value = contrib_ressource, type = ActionType.RESOURCE)
public void update(final HttpServerRequest request) {
final String sbfId = request.params().get("id");
if (sbfId == null || sbfId.trim().isEmpty()) {
badRequest(request);
return;
}
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
RequestUtils.bodyToJson(request, pathPrefix + "update", new Handler<JsonObject>() {
public void handle(JsonObject data) {
final Long expiryDate = data.getNumber("expiryDate").longValue();
data.removeField("expiryDate");
data.putObject("expiryDate", new JsonObject().putValue("$date", expiryDate));
shareBigFileCrudService.update(sbfId, data, defaultResponseHandler(request));
}
});
} else {
if (log.isDebugEnabled()) {
log.debug("User not found in session.");
}
Renders.unauthorized(request);
}
}
});
}
示例8: get
@Get("/pages/:id")
@ApiDoc("Get page by id.")
@ResourceFilter(PageReadFilter.class)
@SecuredAction(value = "page.read", type = ActionType.RESOURCE)
public void get(HttpServerRequest request) {
retrieve(request);
}
示例9: delete
@Override
@Delete("/pages/:id")
@ApiDoc("Delete page by id.")
@ResourceFilter(ShareAndOwner.class)
@SecuredAction(value = "page.manager", type = ActionType.RESOURCE)
public void delete(HttpServerRequest request) {
super.delete(request);
}
示例10: share
@Get("/pages/share/json/:id")
@ApiDoc("Get share list.")
@ResourceFilter(ShareAndOwner.class)
@SecuredAction(value = "page.manager", type = ActionType.RESOURCE)
public void share(HttpServerRequest request) {
shareJson(request, false);
}
示例11: create
@Override
@Post("/type/:id/resource") // Parameter "id" is the resourceTypeId
@ApiDoc("Create resource")
@ResourceFilter(TypeOwnerSharedOrLocalAdmin.class)
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void create(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_RESOURCE_CREATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
long minDelay = resource.getLong("min_delay", -1L);
long maxDelay = resource.getLong("max_delay", -1L);
if(minDelay > -1L && maxDelay > -1L && minDelay >= maxDelay) {
badRequest(request, "rbs.resource.bad.request.min_delay.greater.than.max_delay");
}
String resourceTypeId = request.params().get("id");
resource.putString("type_id", resourceTypeId);
resourceService.createResource(resource, user, notEmptyResponseHandler(request));
}
});
} else {
log.debug("User not found in session.");
Renders.unauthorized(request);
}
}
});
}
示例12: delete
@Override
@Delete("/:id")
@ApiDoc("Allows to delete a collaborative editor associated to the given identifier")
@SecuredAction(value = "collaborativeeditor.manager", type = ActionType.RESOURCE)
public void delete(HttpServerRequest request) {
etherpadHelper.delete(request);
}
示例13: shareSubmit
@Put("/resource/share/json/:id")
@ApiDoc("Add rights for a given resource")
@ResourceFilter(TypeAndResourceAppendPolicy.class)
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void shareSubmit(final HttpServerRequest request) {
super.shareJsonSubmit(request, null, false);
}
示例14: shareInfoRemove
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/share/remove/:"+INFO_ID_PARAMETER)
@ApiDoc("Remove Share by id.")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.contrib", type = ActionType.RESOURCE)
public void shareInfoRemove(final HttpServerRequest request) {
removeShare(request, false);
}
示例15: submit
@Put("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/:"+Actualites.INFO_RESOURCE_ID+"/submit")
@ApiDoc("Submit : Change an Info to Pending state in thread by thread and by id")
@ResourceFilter(InfoFilter.class)
@SecuredAction(value = "thread.contrib", type = ActionType.RESOURCE)
public void submit(final HttpServerRequest request) {
final String threadId = request.params().get(Actualites.THREAD_RESOURCE_ID);
final String infoId = request.params().get(Actualites.INFO_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, new Handler<JsonObject>() {
@Override
public void handle(JsonObject body) {
final String title = body.getString("title");
Handler<Either<String, JsonObject>> handler = new Handler<Either<String, JsonObject>>() {
@Override
public void handle(Either<String, JsonObject> event) {
if (event.isRight()) {
notifyTimeline(request, user, threadId, infoId, title, NEWS_SUBMIT_EVENT_TYPE);
renderJson(request, event.right().getValue(), 200);
} else {
JsonObject error = new JsonObject().putString("error", event.left().getValue());
renderJson(request, error, 400);
}
}
};
JsonObject resource = new JsonObject();
resource.putNumber("status", status_list.get(2));
infoService.update(infoId, resource, user, Events.SUBMIT.toString(),
notEmptyResponseHandler(request));
}
});
}
});
}