Displaying Office Mage rights with a method

Jussi Rautio 2 years ago in Home Portal updated by Dariusz Gołąb 2 years ago 4

I'm trying to create a virtual column/macro for a Customer Contact Person whether they have Customer Portal access, can they access multiple offices in the portal, and which kind of Manage Rights they have (Default Office, Department...)

I can get the access status with canLogInToCustomerPortal() and the offices with isAssociatedWithManyCustomers()

However, the method canManageOnlyRelated() does not work. Is there a work-around to see which kind of rights the Contact Person has?

What we can suggest in here is to use "getAccount()" method on Client Contact Person, which should return the System Account of this Contact person. In System Account there are some methods that can be used to check particular Contact Person's rights. Please check if one (ore more) of these methods will be sufficient for You.


You could try one of the two:

  1. getAccount()  method on Client Contact Person, which returns the System Account and there getCustomerContactManagePolicy() returns CustomerContactManagePolicy (ONLY_RELATED_QUOTES_AND_PROJECTS, DEPARTMENT, OFFICE or ALL_DEFINED_OFFICES )
  2. getAccessLimits() returns CustomerPersonAccessLimits which in turn returns such data as:
    • private final Customer defaultOffice;
    • private final Collection<Customer> limitToOffices;
    • private final Optional<CustomerPerson> limitToContact;
    • private final Optional<PersonDepartment> limitToDepartment;

I don't get it. In Client Contact Person scope:

$utils.unwrap($this).canLogInToCustomerPortal() -> true
$utils.unwrap($this).getAccount() -> invalid method

canLogInToCustomerPortal() returns true for every client contact person or client. This method's result depends on the user type (returns false for vendor, vendor contact person or home portal user).