Commits

Sebastian Sdorra committed 31d672b

javadoc

  • Participants
  • Parent commits c837722
  • Branches issue-340

Comments (0)

Files changed (7)

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

 import javax.xml.bind.annotation.XmlRootElement;
 
 /**
+ * Permission object which is assigned to a specific user or group.
  *
  * @author Sebastian Sdorra
  * @since 1.31
 public class AssignedPermission implements PermissionObject, Serializable
 {
 
-  /** Field description */
+  /** serial version uid */
   private static final long serialVersionUID = -7411338422110323879L;
 
   //~--- constructors ---------------------------------------------------------
   public AssignedPermission() {}
 
   /**
-   * Constructs ...
+   * Constructs a new AssignedPermission.
    *
    *
-   * @param permission
+   * @param permission assigned permission
    */
   public AssignedPermission(AssignedPermission permission)
   {
   }
 
   /**
-   * Constructs ...
+   * Constructs a new AssingnedPermmission.
    *
    *
-   * @param name
-   * @param permission
+   * @param name name of the user
+   * @param permission permission string
    */
   public AssignedPermission(String name, String permission)
   {
   }
 
   /**
-   * Constructs ...
+   * Constructs a new AssingnedPermmission.
    *
    *
-   * @param name
-   * @param groupPermission
-   * @param permission
+   * @param name name of the user or group
+   * @param groupPermission true if the permission should be assigned to a group
+   * @param permission permission string
    */
   public AssignedPermission(String name, boolean groupPermission,
     String permission)
   //~--- methods --------------------------------------------------------------
 
   /**
-   * Method description
-   *
-   *
-   * @param obj
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public boolean equals(Object obj)
   }
 
   /**
-   * Method description
-   *
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public int hashCode()
   }
 
   /**
-   * Method description
-   *
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public String toString()
   //~--- get methods ----------------------------------------------------------
 
   /**
-   * Method description
+   * Returns the name of the user or group which the permission is assigned.
    *
    *
-   * @return
+   * @return name of user or group
    */
   @Override
   public String getName()
   }
 
   /**
-   * Method description
+   * Returns the string representation of the permission.
    *
    *
-   * @return
+   * @return string representation of the permission
    */
   public String getPermission()
   {
   }
 
   /**
-   * Method description
+   * Returns true if the permission is assigned to a group.
    *
    *
-   * @return
+   * @return true if the permission is assigned to a group
    */
   @Override
   public boolean isGroupPermission()
 
   //~--- fields ---------------------------------------------------------------
 
-  /** Field description */
+  /** group permission indicator */
   @XmlElement(name = "group-permission")
   private boolean groupPermission;
 
-  /** Field description */
+  /** name of the user or group */
   private String name;
 
-  /** Field description */
+  /** string representation of the permission */
   private String permission;
 }

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

 import javax.xml.bind.annotation.XmlRootElement;
 
 /**
+ * Descriptor for available permission objects.
  *
  * @author Sebastian Sdorra
  * @since 1.31
   //~--- methods --------------------------------------------------------------
 
   /**
-   * Method description
-   *
-   *
-   * @param obj
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public boolean equals(Object obj)
   }
 
   /**
-   * Method description
-   *
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public int hashCode()
   }
 
   /**
-   * Method description
-   *
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public String toString()
   //~--- get methods ----------------------------------------------------------
 
   /**
-   * Method description
+   * Returns the description of the permission.
    *
    *
-   * @return
+   * @return description
    */
   public String getDescription()
   {
   }
 
   /**
-   * Method description
+   * Returns the display name of the permission.
    *
    *
-   * @return
+   * @return display name
    */
   public String getDisplayName()
   {
   }
 
   /**
-   * Method description
+   * Returns the string representation of the permission.
    *
    *
-   * @return
+   * @return string representation
    */
   public String getValue()
   {
 
   //~--- fields ---------------------------------------------------------------
 
-  /** Field description */
+  /** description */
   private String description;
 
-  /** Field description */
+  /** display name */
   @XmlElement(name = "display-name")
   private String displayName;
 
-  /** Field description */
+  /** value */
   private String value;
 }

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

 package sonia.scm.security;
 
 /**
+ * Interface for permission objects.
  *
  * @author Sebastian Sdorra
  * @since 1.31
 {
 
   /**
-   * Method description
+   * Returns the name of the user or group which the permission is assigned.
    *
    *
-   * @return
+   * @return name of user or group
    */
   public String getName();
 
   /**
-   * Method description
+   * Returns the id of the stored permission object.
    *
    *
-   * @return
+   * @return id of permission
    */
   public boolean isGroupPermission();
 }

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

 
 import com.google.common.base.Predicate;
 
-import org.apache.shiro.subject.PrincipalCollection;
-
 //~--- JDK imports ------------------------------------------------------------
 
 import java.util.List;
 
 /**
+ * The SecuritySystem manages global permissions.
  *
  * @author Sebastian Sdorra
  * @since 1.31
 {
 
   /**
-   * Method description
+   * Store a new permission.
    *
    *
-   * @param permission
+   * @param permission permission to be stored
    *
-   * @return
+   * @return stored permission
    */
   public StoredAssignedPermission addPermission(AssignedPermission permission);
 
   /**
-   * Method description
+   * Delete stored permission.
    *
    *
-   * @param permission
+   * @param permission permission to be deleted
    */
   public void deletePermission(StoredAssignedPermission permission);
 
   /**
-   * Method description
+   * Delete stored permission.
    *
    *
-   * @param id
+   * @param id id  of the permission
    */
   public void deletePermission(String id);
 
   /**
-   * Method description
+   * Modify stored permission.
    *
    *
-   * @param id
-   * @param permission
+   * @param permission stored permisison
    */
   public void modifyPermission(StoredAssignedPermission permission);
 
   //~--- get methods ----------------------------------------------------------
 
   /**
-   * Method description
+   * Return all stored permissions.
    *
    *
-   * @return
+   * @return stored permission
    */
   public List<StoredAssignedPermission> getAllPermissions();
 
   /**
-   * Method description
+   * Return all available permissions.
    *
    *
-   * @return
+   * @return available permissions
    */
   public List<PermissionDescriptor> getAvailablePermissions();
 
   /**
-   * Method description
+   * Return the stored permission which is stored with the given id.
    *
    *
-   * @param id
+   * @param id id of the stored permission
    *
-   * @return
+   * @return stored permission
    */
   public StoredAssignedPermission getPermission(String id);
 
   /**
-   * Method description
+   * Returns all stored permissions which are matched by the given
+   * {@link Predicate}.
    *
    *
-   * @param predicate
+   * @param predicate predicate to filter
    *
-   * @return
+   * @return filtered permissions
    */
   public List<StoredAssignedPermission> getPermissions(
     Predicate<AssignedPermission> predicate);
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  public PrincipalCollection getSystemAccount();
 }

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

 import javax.xml.bind.annotation.XmlRootElement;
 
 /**
+ * Permission object which is stored and assigned to a specific user or group.
  *
  * @author Sebastian Sdorra
  * @since 1.31
 public class StoredAssignedPermission extends AssignedPermission
 {
 
-  /** Field description */
+  /** serial version uid */
   private static final long serialVersionUID = -4593919877023168090L;
 
   //~--- constructors ---------------------------------------------------------
   public StoredAssignedPermission() {}
 
   /**
-   * Constructs ...
+   * Constructs a new StoredAssignedPermission.
    *
    *
-   * @param id
-   * @param permission
+   * @param id id of the permission object
+   * @param permission assigned permission object
    */
   public StoredAssignedPermission(String id, AssignedPermission permission)
   {
   //~--- get methods ----------------------------------------------------------
 
   /**
-   * Method description
+   * Returns the id of the stored permission object.
    *
    *
-   * @return
+   * @return id of permission
    */
   public String getId()
   {
 
   //~--- fields ---------------------------------------------------------------
 
-  /** Field description */
+  /** id */
   private String id;
 }

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

 import java.io.Serializable;
 
 /**
+ * Event which is fired after a {@link StoredAssignedPermission} was added,
+ * removed or changed.
  *
  * @author Sebastian Sdorra
  * @since 1.31
 public final class StoredAssignedPermissionEvent implements Serializable
 {
 
-  /** Field description */
+  /** serial version uid */
   private static final long serialVersionUID = 706824497813169009L;
 
   //~--- constructors ---------------------------------------------------------
 
   /**
-   * Constructs ...
+   * Constructs a new StoredAssignedPermissionEvent.
    *
    *
-   * @param type
-   * @param permission
+   * @param type type of the event
+   * @param permission permission object which has changed
    */
   public StoredAssignedPermissionEvent(HandlerEvent type,
     StoredAssignedPermission permission)
   //~--- methods --------------------------------------------------------------
 
   /**
-   * Method description
-   *
-   *
-   * @param obj
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public boolean equals(Object obj)
   }
 
   /**
-   * Method description
-   *
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public int hashCode()
   }
 
   /**
-   * Method description
-   *
-   *
-   * @return
+   * {@inheritDoc}
    */
   @Override
   public String toString()
   //~--- get methods ----------------------------------------------------------
 
   /**
-   * Method description
+   * Return the type of the event.
    *
    *
-   * @return
+   * @return type of event
    */
   public HandlerEvent getEventType()
   {
   }
 
   /**
-   * Method description
+   * Returns the changed permission object.
    *
    *
-   * @return
+   * @return changed permission
    */
   public StoredAssignedPermission getPermission()
   {
 
   //~--- fields ---------------------------------------------------------------
 
-  /** Field description */
+  /** changed permission */
   private StoredAssignedPermission permission;
 
-  /** Field description */
+  /** type of the event */
   private HandlerEvent type;
 }

File scm-webapp/src/main/java/sonia/scm/security/DefaultSecuritySystem.java

 import com.google.inject.Singleton;
 
 import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.subject.PrincipalCollection;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
     return permissions.build();
   }
 
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  @Override
-  public PrincipalCollection getSystemAccount()
-  {
-
-    // TODO
-    throw new UnsupportedOperationException("Not supported yet.");
-  }
-
   //~--- methods --------------------------------------------------------------
 
   /**