use of fi.otavanopisto.security.rest.RESTPermit in project muikku by otavanopisto.
the class AcceptanceTestsRESTService method createCommunicatorUserLabel.
@POST
@Path("/communicator/labels/user/{ID}")
@RESTPermit(handling = Handling.UNSECURED)
public Response createCommunicatorUserLabel(@PathParam("ID") Long userId, fi.otavanopisto.muikku.atests.CommunicatorUserLabelRESTModel payload) {
UserEntity userEntity = userEntityController.findUserEntityById(userId);
CommunicatorUserLabelRESTModel newUserLabel = new CommunicatorUserLabelRESTModel(null, payload.getName(), payload.getColor());
communicatorController.createUserLabel(newUserLabel.getName(), newUserLabel.getColor(), userEntity);
return Response.ok().build();
}
use of fi.otavanopisto.security.rest.RESTPermit in project muikku by otavanopisto.
the class AcceptanceTestsRESTService method deleteFlag.
@DELETE
@Path("/flags/{FLAGID}")
@RESTPermit(handling = Handling.UNSECURED)
public Response deleteFlag(@PathParam("FLAGID") Long flagId) {
Flag flag = flagController.findFlagById(flagId);
if (flag == null) {
return Response.status(Status.BAD_REQUEST).entity("Flag not found").build();
}
flagController.deleteFlag(flag);
return Response.noContent().build();
}
use of fi.otavanopisto.security.rest.RESTPermit in project muikku by otavanopisto.
the class AcceptanceTestsRESTService method deleteUserGroup.
@DELETE
@Path("/userGroups/{USERGROUPID}")
@RESTPermit(handling = Handling.UNSECURED)
public Response deleteUserGroup(@PathParam("USERGROUPID") Long userGroupId) {
UserGroupEntity userGroup = userGroupEntityController.findUserGroupEntityById(userGroupId);
for (UserGroupUserEntity userGroupUser : userGroupEntityController.listUserGroupUserEntitiesByUserGroupEntity(userGroup)) {
userGroupEntityController.deleteUserGroupUserEntity(userGroupUser);
}
userGroupEntityController.deleteUserGroupEntity(userGroup);
return Response.noContent().build();
}
use of fi.otavanopisto.security.rest.RESTPermit in project muikku by otavanopisto.
the class AcceptanceTestsRESTService method deletePasswordChangeEntry.
@DELETE
@Path("/passwordchange/{EMAIL}")
@RESTPermit(handling = Handling.UNSECURED)
public Response deletePasswordChangeEntry(@PathParam("EMAIL") String email) {
UserEntity userEntity = userEntityController.findUserEntityByEmailAddress(email);
if (userEntity == null)
return Response.status(Status.NOT_FOUND).build();
UserPendingPasswordChange userPendingPasswordChange = userPendingPasswordChangeDAO.findByUserEntity(userEntity);
userPendingPasswordChangeDAO.delete(userPendingPasswordChange);
return Response.noContent().build();
}
use of fi.otavanopisto.security.rest.RESTPermit in project muikku by otavanopisto.
the class AcceptanceTestsRESTService method test_reindex.
@GET
@Path("/reindex")
@Produces("text/plain")
@RESTPermit(handling = Handling.UNSECURED)
public Response test_reindex() {
logger.log(Level.INFO, "Acceptance tests plugin reindex task started.");
List<WorkspaceEntity> workspaceEntities = workspaceEntityController.listWorkspaceEntities();
for (int i = 0; i < workspaceEntities.size(); i++) {
WorkspaceEntity workspaceEntity = workspaceEntities.get(i);
workspaceIndexer.indexWorkspace(workspaceEntity);
}
logger.log(Level.INFO, "Reindexed " + workspaceEntities.size() + " workspaces");
List<UserEntity> users = userEntityController.listUserEntities();
for (int i = 0; i < users.size(); i++) {
UserEntity userEntity = users.get(i);
userIndexer.indexUser(userEntity);
}
logger.log(Level.INFO, "Reindexed " + users.size() + " users");
return Response.ok().build();
}
Aggregations