Commits

Sebastian Sdorra committed d1433b8

improve api for global permissions

  • Participants
  • Parent commits cf291b1
  • Branches issue-340

Comments (0)

Files changed (7)

File scm-core/src/main/java/sonia/scm/security/AssignedPermission.java

+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.security;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.31
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "assigned-permission")
+public class AssignedPermission implements PermissionObject
+{
+
+  /**
+   * Constructor is only visible for JAXB.
+   *
+   */
+  public AssignedPermission() {}
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param permission
+   */
+  public AssignedPermission(AssignedPermission permission)
+  {
+    this.name = permission.name;
+    this.groupPermission = permission.groupPermission;
+    this.permission = permission.permission;
+  }
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param name
+   * @param permission
+   */
+  public AssignedPermission(String name, String permission)
+  {
+    this.name = name;
+    this.permission = permission;
+  }
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param name
+   * @param groupPermission
+   * @param permission
+   */
+  public AssignedPermission(String name, boolean groupPermission,
+    String permission)
+  {
+    this.name = name;
+    this.groupPermission = groupPermission;
+    this.permission = permission;
+  }
+
+  //~--- get methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  @Override
+  public String getName()
+  {
+    return name;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getPermission()
+  {
+    return permission;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  @Override
+  public boolean isGroupPermission()
+  {
+    return groupPermission;
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  @XmlElement(name = "group-permission")
+  private boolean groupPermission;
+
+  /** Field description */
+  private String name;
+
+  /** Field description */
+  private String permission;
+}

File scm-core/src/main/java/sonia/scm/security/GlobalPermission.java

-/**
- * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer. 2. Redistributions in
- * binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or other
- * materials provided with the distribution. 3. Neither the name of SCM-Manager;
- * nor the names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://bitbucket.org/sdorra/scm-manager
- *
- */
-
-
-
-package sonia.scm.security;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import com.google.common.base.Objects;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.Serializable;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- * @author Sebastian Sdorra
- * @since 1.31
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = "global-permission")
-public final class GlobalPermission implements PermissionObject, Serializable
-{
-
-  /** Field description */
-  private static final long serialVersionUID = 4794267414178121515L;
-
-  //~--- constructors ---------------------------------------------------------
-
-  /**
-   * Constructs ...
-   *
-   */
-  public GlobalPermission() {}
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param id
-   * @param name
-   * @param permission
-   */
-  public GlobalPermission(String name, String permission)
-  {
-    this(name, false, permission);
-  }
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param id
-   * @param name
-   * @param group
-   * @param permission
-   */
-  public GlobalPermission(String name, boolean groupPermission, String permission)
-  {
-    this.name = name;
-    this.groupPermission = groupPermission;
-    this.permission = permission;
-  }
-
-  //~--- methods --------------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @param obj
-   *
-   * @return
-   */
-  @Override
-  public boolean equals(Object obj)
-  {
-    if (obj == null)
-    {
-      return false;
-    }
-
-    if (getClass() != obj.getClass())
-    {
-      return false;
-    }
-
-    final GlobalPermission other = (GlobalPermission) obj;
-
-    //J-
-    return Objects.equal(name, other.name)
-      && Objects.equal(groupPermission, other.groupPermission)
-      && Objects.equal(permission, other.permission);
-    //J+
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  @Override
-  public int hashCode()
-  {
-    return Objects.hashCode(name, groupPermission, permission);
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  @Override
-  public String toString()
-  {
-    //J-
-    return Objects.toStringHelper(this)
-                  .add("name", name)
-                  .add("groupPermission", groupPermission)
-                  .add("permisison", permission)
-                  .toString();
-    //J+
-  }
-
-  //~--- get methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  @Override
-  public String getName()
-  {
-    return name;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public String getPermission()
-  {
-    return permission;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  @Override
-  public boolean isGroupPermission()
-  {
-    return groupPermission;
-  }
-
-  //~--- fields ---------------------------------------------------------------
-
-  /** Field description */
-  @XmlElement(name = "group")
-  private boolean groupPermission;
-
-  /** Field description */
-  private String name;
-
-  /** Field description */
-  private String permission;
-}

File scm-core/src/main/java/sonia/scm/security/PermissionDescriptor.java

+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.security;
+
+//~--- non-JDK imports --------------------------------------------------------
+
+import com.google.common.base.Objects;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.31
+ */
+@XmlRootElement(name = "permissions")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class PermissionDescriptor implements Serializable
+{
+
+  /** Field description */
+  private static final long serialVersionUID = -9141065458354047154L;
+
+  //~--- constructors ---------------------------------------------------------
+
+  /**
+   * Constructor is only visible for JAXB.
+   *
+   */
+  public PermissionDescriptor() {}
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param displayName
+   * @param description
+   * @param value
+   */
+  public PermissionDescriptor(String displayName, String description,
+    String value)
+  {
+    this.displayName = displayName;
+    this.description = description;
+    this.value = value;
+  }
+
+  //~--- methods --------------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @param obj
+   *
+   * @return
+   */
+  @Override
+  public boolean equals(Object obj)
+  {
+    if (obj == null)
+    {
+      return false;
+    }
+
+    if (getClass() != obj.getClass())
+    {
+      return false;
+    }
+
+    final PermissionDescriptor other = (PermissionDescriptor) obj;
+
+    return Objects.equal(displayName, other.displayName)
+      && Objects.equal(description, other.description)
+      && Objects.equal(value, other.value);
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  @Override
+  public int hashCode()
+  {
+    return Objects.hashCode(displayName, description, value);
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  @Override
+  public String toString()
+  {
+
+    //J-
+    return Objects.toStringHelper(this)
+                  .add("displayName", displayName)
+                  .add("description", description)
+                  .add("value", value)
+                  .toString();
+
+    //J+
+  }
+
+  //~--- get methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getDescription()
+  {
+    return description;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getDisplayName()
+  {
+    return displayName;
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getValue()
+  {
+    return value;
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private String description;
+
+  /** Field description */
+  @XmlElement(name = "display-name")
+  private String displayName;
+
+  /** Field description */
+  private String value;
+}

File scm-core/src/main/java/sonia/scm/security/SecurityConfiguration.java

-/**
- * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer. 2. Redistributions in
- * binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or other
- * materials provided with the distribution. 3. Neither the name of SCM-Manager;
- * nor the names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://bitbucket.org/sdorra/scm-manager
- *
- */
-
-
-
-package sonia.scm.security;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import com.google.common.collect.Lists;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- * @author Sebastian Sdorra
- * @since 1.31
- */
-@XmlRootElement(name = "security")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class SecurityConfiguration
-{
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public List<GlobalPermission> getGlobalPermissions()
-  {
-    if (globalPermissions == null)
-    {
-      globalPermissions = Lists.newArrayList();
-    }
-
-    return globalPermissions;
-  }
-
-  //~--- fields ---------------------------------------------------------------
-
-  /** Field description */
-  @XmlElement(name = "permission")
-  @XmlElementWrapper(name = "global-permissions")
-  private List<GlobalPermission> globalPermissions;
-}

File scm-core/src/main/java/sonia/scm/security/SecurityConfigurationChangedEvent.java

-/**
- * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer. 2. Redistributions in
- * binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or other
- * materials provided with the distribution. 3. Neither the name of SCM-Manager;
- * nor the names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://bitbucket.org/sdorra/scm-manager
- *
- */
-
-
-
-package sonia.scm.security;
-
-/**
- *
- * @author Sebastian Sdorra
- * @since 1.31
- */
-public class SecurityConfigurationChangedEvent
-{
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param oldConfiguration
-   * @param newConfiguration
-   */
-  public SecurityConfigurationChangedEvent(
-    SecurityConfiguration oldConfiguration,
-    SecurityConfiguration newConfiguration)
-  {
-    this.oldConfiguration = oldConfiguration;
-    this.newConfiguration = newConfiguration;
-  }
-
-  //~--- get methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public SecurityConfiguration getNewConfiguration()
-  {
-    return newConfiguration;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public SecurityConfiguration getOldConfiguration()
-  {
-    return oldConfiguration;
-  }
-
-  //~--- fields ---------------------------------------------------------------
-
-  /** Field description */
-  private SecurityConfiguration newConfiguration;
-
-  /** Field description */
-  private SecurityConfiguration oldConfiguration;
-}

File scm-core/src/main/java/sonia/scm/security/SecuritySystem.java

 
 //~--- non-JDK imports --------------------------------------------------------
 
+import com.google.common.base.Predicate;
+
 import org.apache.shiro.subject.PrincipalCollection;
 
+//~--- JDK imports ------------------------------------------------------------
+
+import java.util.List;
+
 /**
  *
  * @author Sebastian Sdorra
    * Method description
    *
    *
+   * @param permission
+   *
    * @return
    */
-  public SecurityConfiguration getConfiguration();
+  public StoredAssignedPermission addPermission(AssignedPermission permission);
 
   /**
    * Method description
    *
    *
-   * @return
+   * @param permission
    */
-  public PrincipalCollection getSystemAccount();
-
-  //~--- set methods ----------------------------------------------------------
+  public void deletePermission(StoredAssignedPermission permission);
 
   /**
    * Method description
    *
    *
-   * @param configuration
+   * @param id
    */
-  public void setConfiguration(SecurityConfiguration configuration);
+  public void deletePermission(String id);
+
+  /**
+   * Method description
+   *
+   *
+   * @param id
+   * @param permission
+   */
+  public void modifyPermission(StoredAssignedPermission permission);
+
+  //~--- get methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public List<StoredAssignedPermission> getAllPermissions();
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public List<PermissionDescriptor> getAvailablePermissions();
+
+  /**
+   * Method description
+   *
+   *
+   * @param predicate
+   *
+   * @return
+   */
+  public List<StoredAssignedPermission> getPermissions(
+    Predicate<AssignedPermission> predicate);
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public PrincipalCollection getSystemAccount();
 }

File scm-core/src/main/java/sonia/scm/security/StoredAssignedPermission.java

+/**
+ * Copyright (c) 2010, Sebastian Sdorra All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer. 2. Redistributions in
+ * binary form must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution. 3. Neither the name of SCM-Manager;
+ * nor the names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * http://bitbucket.org/sdorra/scm-manager
+ *
+ */
+
+
+
+package sonia.scm.security;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ *
+ * @author Sebastian Sdorra
+ * @since 1.31
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "assigned-permission")
+public class StoredAssignedPermission extends AssignedPermission
+{
+
+  /**
+   * Constructor is only visible for JAXB.
+   *
+   */
+  public StoredAssignedPermission() {}
+
+  /**
+   * Constructs ...
+   *
+   *
+   * @param id
+   * @param permission
+   */
+  public StoredAssignedPermission(String id, AssignedPermission permission)
+  {
+    super(permission);
+    this.id = id;
+
+  }
+
+  //~--- get methods ----------------------------------------------------------
+
+  /**
+   * Method description
+   *
+   *
+   * @return
+   */
+  public String getId()
+  {
+    return id;
+  }
+
+  //~--- fields ---------------------------------------------------------------
+
+  /** Field description */
+  private String id;
+}