package com.celements.model.access.exception;

import org.xwiki.model.reference.DocumentReference;

import com.celements.rights.AccessLevel;
import com.xpn.xwiki.user.api.XWikiUser;

public class NoAccessRightsException extends DocumentAccessException {

  private static final long serialVersionUID = -2592241907630457229L;

  private XWikiUser user;
  
  private AccessLevel expectedAccessLevel;

  public NoAccessRightsException(DocumentReference docRef, XWikiUser user,
      AccessLevel expectedAccessLevel) {
    super(docRef);
    this.user = user;
    this.expectedAccessLevel = expectedAccessLevel;
  }

  public NoAccessRightsException(DocumentReference docRef, XWikiUser user,
      AccessLevel expectedAccessLevel, Throwable cause) {
    super(docRef, cause);
    this.user = user;
    this.expectedAccessLevel = expectedAccessLevel;
  }

  public XWikiUser getUser() {
    return user;
  }

  public AccessLevel getExpectedAccessLevel() {
    return expectedAccessLevel;
  }

}

@@ -73,24 +73,22 @@
 ference.
-Document
+Entity
 Referenc
@@ -223,22 +223,8 @@
 nds 
-DocumentAccess
 Exce
@@ -303,16 +303,54 @@
 7229L;%0A%0A
+  private EntityReference entityRef;%0A%0A
   privat
@@ -443,32 +443,30 @@
 tsException(
-Document
+Entity
 Reference do
@@ -455,35 +455,38 @@
 EntityReference 
-doc
+entity
 Ref, XWikiUser u
@@ -545,15 +545,41 @@
 per(
-docRef)
+);%0A    this.entityRef = entityRef
 ;%0A  
@@ -692,16 +692,14 @@
 ion(
-Document
+Entity
 Refe
@@ -704,19 +704,22 @@
 ference 
-doc
+entity
 Ref, XWi
@@ -803,22 +803,46 @@
 per(
-docRef, cause)
+cause);%0A    this.entityRef = entityRef
 ;%0A  
@@ -908,32 +908,103 @@
 AccessLevel;%0A  %7D
+%0A  %0A  public EntityReference getEntityRef() %7B%0A    return entityRef;%0A  %7D
 %0A%0A  public XWiki

change NoAccessRightsException to extend Exception instead of DocumentAccessException