io.robe.admin.resources.PermissionResource Maven / Gradle / Ivy
The newest version!
package io.robe.admin.resources;
import io.dropwizard.hibernate.UnitOfWork;
import io.dropwizard.jersey.PATCH;
import io.robe.admin.dto.MenuItem;
import io.robe.admin.dto.PermissionUpdateDto;
import io.robe.admin.hibernate.dao.MenuDao;
import io.robe.admin.hibernate.dao.PermissionDao;
import io.robe.admin.hibernate.dao.ServiceDao;
import io.robe.admin.hibernate.entity.Menu;
import io.robe.admin.hibernate.entity.Permission;
import io.robe.admin.hibernate.entity.Service;
import io.robe.auth.Credentials;
import io.robe.auth.RobeAuth;
import io.robe.auth.token.BasicToken;
import io.robe.common.service.RobeService;
import io.robe.common.service.search.SearchParam;
import io.robe.common.service.search.model.SearchModel;
import io.robe.common.utils.FieldReflection;
import org.hibernate.FlushMode;
import javax.inject.Inject;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.hibernate.CacheMode.GET;
@Path("permissions")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class PermissionResource {
@Inject
private PermissionDao permissionDao;
@Inject
private ServiceDao serviceDao;
@Inject
private MenuDao menuDao;
/**
* get hierarchical menu service for permission
*
* @param credentials Injected by {@link RobeAuth} annotation for authentication.
* @return collection of hierarchical {@link MenuItem}
*/
@RobeService(group = "Permission", description = "Get hierarchical menu service for permission")
@Path("menus")
@GET
@UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL)
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy