Custom entity and limiting visibility of it and related entities to regular users

Information and discussions on the Broadleaf Commerce Admin Tool

Moderator: jocanas

labedzkim
Newbie
Newbie
Posts: 5
Joined: Tue Jun 02, 2015 4:41 am

Custom entity and limiting visibility of it and related entities to regular users

Postby labedzkim » Thu Feb 16, 2017 8:59 am

Hi All,
please guide me on how to solve my issue which I'll try to describe as short as possible below.

In my admin application there are two groups of users, each having a role defined: admins and regular users. I'got a custom entity that represents an access-right for paricular product granted to a parcirular regular user. That grant is implemented as an associative table for a user, product and order.

My current state is that being a customer I can select an order, customer and product, then I can add a new grant. Now I'm going to restrict a regular user so that he/she can choose (look up) only from a limited set. Then I'll need to restrict the user to see only those grants that he/she has created.

How should I do it?

Maciej

Code: Select all

@Entity
@Table(name = "FOOD_PRODUCT_GRANT")
@AdminPresentationClass(friendlyName = "Product Grant")
public class FoodieProductGrant implements Serializable {

    @Id
    @GeneratedValue(generator = "FoodieProductGrantId")
    @GenericGenerator(
            name = "FoodieProductGrantId",
            strategy = "org.broadleafcommerce.common.persistence.IdOverrideTableGenerator",
            parameters = {
                    @Parameter(name = "segment_value", value = "FoodieProductGrant"), @Parameter(name = "entity_name",
                    value = "eu.foodieproject.core.catalog.domain.FoodieProductGrant")
            })
    @Column(name = "PRODUCT_GRANT_ID")
    private Long id;

    @ManyToOne(targetEntity = FoodieProduct.class, optional = false)
    @JoinColumn(name = "FOODIE_PRODUCT_ID", nullable = false)
    @AdminPresentation(friendlyName = "ProductImpl_baseProduct", group = "Details",
            order= 3, groupOrder = 1000, prominent = true)
    @AdminPresentationToOneLookup
    private FoodieProduct foodieProduct;

    @ManyToOne(targetEntity = CustomerImpl.class, optional=false)
    @JoinColumn(name = "CUSTOMER_ID", nullable = false)
    @AdminPresentation(friendlyName = "OrderImpl_Customer", group = "Details",
            order= 2, groupOrder = 1000, prominent = true)
    @AdminPresentationToOneLookup()
    protected Customer customer;


    @Where(clause = "WHERE ORDER_STATUS = 'SUBMITTED'")
    @ManyToOne(targetEntity = OrderImpl.class, optional=false)
    @JoinColumn(name = "ORDER_ID", nullable = false)
    @AdminPresentation(friendlyName = "OrderImpl_baseOrder", group = "Details",
            order= 1, groupOrder = 1000, prominent = true)
    @AdminPresentationToOneLookup()
    protected Order order;
}

Return to “Broadleaf Commerce Admin”

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest