io.robe.admin.resources.RoleResource 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.hibernate.dao.*;
import io.robe.admin.hibernate.entity.*;
import io.robe.auth.Credentials;
import io.robe.auth.RobeAuth;
import io.robe.auth.data.entry.PermissionEntry;
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("roles")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class RoleResource {
@Inject
private RoleDao roleDao;
@Inject
private PermissionDao permissionDao;
@Inject
private RoleGroupDao roleGroupDao;
@Inject
private ServiceDao serviceDao;
@Inject
private MenuDao menuDao;
/**
* Returns all services and menus collection with the matches given Role id.
*
* @param credentials Injected by {@link RobeAuth} annotation for authentication.
* @param id This is Role oid
* @return JSONObject (MENU and SERVICE)
*/
@RobeService(group = "Permission", description = "Returns all services and menus collection with the matches given Role id.")
@GET
@Path("{id}/permissions")
@UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL)
public Map getRolePermissions(@RobeAuth Credentials credentials, @PathParam("id") String id) {
List permissions = new ArrayList<>();
List services = new ArrayList<>();
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy