本文整理汇总了Java中fr.wseduc.security.ActionType类的典型用法代码示例。如果您正苦于以下问题:Java ActionType类的具体用法?Java ActionType怎么用?Java ActionType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionType类属于fr.wseduc.security包,在下文中一共展示了ActionType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Put("/:id")
@SecuredAction(value = "", type = ActionType.RESOURCE)
public void update(final HttpServerRequest request) {
RequestUtils.bodyToJson(request, pathPrefix + "update", new Handler<JsonObject>() {
@Override
public void handle(JsonObject body) {
if (body.size() > 0) {
String name = body.getString("name");
Handler<Either<String, JsonObject>> handler = (name != null && !name.trim().isEmpty()) ?
updatePageHandler(request, name) : notEmptyResponseHandler(request);
communityService.update(request.params().get("id"), body, handler);
} else {
badRequest(request, "empty.json");
}
}
});
}
示例2: delete
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Delete("/:id")
@SecuredAction(value = "", type = ActionType.RESOURCE)
public void delete(final HttpServerRequest request) {
communityService.delete(request.params().get("id"), new Handler<Either<String, JsonObject>>() {
@Override
public void handle(Either<String, JsonObject> r) {
if (r.isRight()) {
JsonObject deletePage = new JsonObject()
.putString("action", "delete")
.putString("pageId", r.right().getValue().getString("pageId"))
.putBoolean("deleteResources", true);
eb.send("communityPages", deletePage);
ok(request);
} else {
leftToResponse(request, r.left());
}
}
});
}
示例3: listUsers
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@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);
}
}
});
}
示例4: updateResourceType
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@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);
}
}
});
}
示例5: deleteResourceType
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@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);
}
}
});
}
示例6: createBooking
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Post("/resource/:id/booking")
@ApiDoc("Create booking of a given resource")
@SecuredAction(value = "rbs.contrib", type= ActionType.RESOURCE)
@ResourceFilter(TypeAndResourceAppendPolicy.class)
public void createBooking(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
RequestUtils.bodyToJson(request, pathPrefix + "createBooking",
getBookingHandler(user, request, true));
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例7: createPeriodicBooking
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@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);
}
}
});
}
示例8: updateBooking
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Put("/resource/:id/booking/:bookingId")
@ApiDoc("Update booking")
@SecuredAction(value = "rbs.contrib", type= ActionType.RESOURCE)
@ResourceFilter(TypeAndResourceAppendPolicy.class)
public void updateBooking(final HttpServerRequest request){
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
RequestUtils.bodyToJson(request, pathPrefix + "updateBooking",
getBookingHandler(user, request, false));
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例9: updatePeriodicBooking
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@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);
}
}
});
}
示例10: getBooking
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Get("/booking/:id")
@ApiDoc("find start date of one booking")
@SecuredAction(value = "rbs.booking.one.id", type= ActionType.AUTHENTICATED)
public void getBooking(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
bookingService.getBooking(request.params().get("id"), new Handler<Either<String, JsonObject>>() {
@Override
public void handle(Either<String, JsonObject> event) {
if (event.isRight()) {
Renders.renderJson(request, event.right().getValue());
} else {
Renders.renderError(request, new JsonObject().putString("error", event.left().getValue()));
}
}
});
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例11: listBookingsByResource
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Get("/resource/:id/bookings")
@ApiDoc("List all bookings for a given resource")
@SecuredAction(value = "rbs.read", type = ActionType.RESOURCE)
@ResourceFilter(TypeAndResourceAppendPolicy.class)
public void listBookingsByResource(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
if (user != null) {
String resourceId = request.params().get("id");
bookingService.listBookingsByResource(resourceId, arrayResponseHandler(request));
} else {
log.debug("User not found in session.");
unauthorized(request);
}
}
});
}
示例12: delete
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Override
@Delete("/resource/:id")
@ApiDoc("Delete resource")
@ResourceFilter(TypeAndResourceAppendPolicy.class)
@SecuredAction(value = "rbs.manager", type = ActionType.RESOURCE)
public void delete(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));
} else {
log.debug("User not found in session.");
Renders.unauthorized(request);
}
}
});
}
示例13: updateThread
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Put("/thread/:" + Actualites.THREAD_RESOURCE_ID)
@ApiDoc("Update thread by id.")
@ResourceFilter(ThreadFilter.class)
@SecuredAction(value = "thread.manager", type = ActionType.RESOURCE)
public void updateThread(final HttpServerRequest request) {
final String threadId = request.params().get(Actualites.THREAD_RESOURCE_ID);
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_THREAD_UPDATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
crudService.update(threadId, resource, user, notEmptyResponseHandler(request));
}
});
}
});
}
示例14: createDraft
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Post("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info")
@ApiDoc("Add a new Info with draft status")
@ResourceFilter(ThreadFilter.class)
@SecuredAction(value = "thread.contrib", type = ActionType.RESOURCE)
public void createDraft(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_INFO_CREATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
resource.putNumber("status", status_list.get(1));
infoService.create(resource, user, Events.DRAFT.toString(),notEmptyResponseHandler(request));
}
});
}
});
}
示例15: createPublished
import fr.wseduc.security.ActionType; //导入依赖的package包/类
@Post("/thread/:"+Actualites.THREAD_RESOURCE_ID+"/info/published")
@ApiDoc("Add a new Info published status")
@ResourceFilter(ThreadFilter.class)
@SecuredAction(value = "thread.publish", type = ActionType.RESOURCE)
public void createPublished(final HttpServerRequest request) {
UserUtils.getUserInfos(eb, request, new Handler<UserInfos>() {
@Override
public void handle(final UserInfos user) {
RequestUtils.bodyToJson(request, pathPrefix + SCHEMA_INFO_CREATE, new Handler<JsonObject>() {
@Override
public void handle(JsonObject resource) {
resource.putNumber("status", status_list.get(3));
infoService.create(resource, user, Events.CREATE_AND_PUBLISH.toString(),notEmptyResponseHandler(request));
}
});
}
});
}