Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Fine grained permissions(execCheckLevel is never called)
Fine grained permissions [message #1430324] Wed, 24 September 2014 08:51 Go to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

I am trying to change a permission into a fine grained permission but whatever I do the method execCheckLevel(int userLevel) never gets called. (A breakpoint in the constructor works fine)

I did put some breakpoints into the implies(Permission p) method of BasicHierarchiePermissions but that also never gets called.

any Idea where this might go wrong (Scout Kepler SR2)

Regards Bertin

public class MedewerkerBewerkenPermission extends BasicHierarchyPermission {

  /**
   * @param name
   */

  private static final long serialVersionUID = 0L;
  public static final int LEVEL_OWN = 50;

  private Long m_medewerkerNr;

  public MedewerkerBewerkenPermission(Long medewerkerNr) {
    super("MedewerkerBewerkenPermission" + "." + medewerkerNr, LEVEL_UNDEFINED);
    m_medewerkerNr = medewerkerNr;
  }

  @Override
  protected boolean execCheckLevel(int userLevel) throws ProcessingException {
    if (SERVICES.getService(IMedewerkerService.class).isEigenMedewerkerRecord(getMedewerkerNr())) {
      return true;
    }
    else {
      return ACCESS.check(new VestigingshoofdPermission());
    }
  }

  public Long getMedewerkerNr() {
    return m_medewerkerNr;
  }
}





Re: Fine grained permissions [message #1430386 is a reply to message #1430324] Wed, 24 September 2014 10:18 Go to previous message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 330
Registered: August 2011
Senior Member
Hi,

have it working although on the wiki the example supposes you have to add a contructor like this:

  public ReadCompanyPermission(Long companyId) {
    super("ReadCompany" + "." + companyId, LEVEL_UNDEFINED);
    m_companyId = companyId;
  }

so my constructor was like this:

public MedewerkerBewerkenPermission(Long medewerkerNr) {
    super("MedewerkerBewerkenPermission" + "." + medewerkerNr, LEVEL_UNDEFINED);
    m_medewerkerNr = medewerkerNr;
  } 

but it does not work then. If I change this to:

public MedewerkerBewerkenPermission(Long medewerkerNr) {
    super("MedewerkerBewerkenPermission", LEVEL_UNDEFINED);
    m_medewerkerNr = medewerkerNr;
  }

it is working So leaving out the part + "." + medewerkerNr then it works. Is this the way it should work and is the example on the wiki misleading or did I make a mistake elsewhere?

Regards Bertin
Previous Topic:AbstractTextField and ITextField
Next Topic:Server side mapping of validations coming from a backend
Goto Forum:
  


Current Time: Sat Dec 16 15:07:11 GMT 2017

Powered by FUDForum. Page generated in 0.02080 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software