mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-02 11:35:57 +01:00
added path to permission
This commit is contained in:
@@ -3,11 +3,18 @@
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
import java.util.Collection;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.group.Group;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -72,19 +79,16 @@ public class HgPermissionBuilder
|
||||
name = createGroupString(name);
|
||||
}
|
||||
|
||||
if (permission.isReadable())
|
||||
if (!firstRead)
|
||||
{
|
||||
if (!firstRead)
|
||||
{
|
||||
read.append(", ");
|
||||
}
|
||||
else
|
||||
{
|
||||
firstRead = false;
|
||||
}
|
||||
|
||||
read.append(name);
|
||||
read.append(", ");
|
||||
}
|
||||
else
|
||||
{
|
||||
firstRead = false;
|
||||
}
|
||||
|
||||
read.append(name);
|
||||
|
||||
if (permission.isWriteable())
|
||||
{
|
||||
@@ -116,7 +120,8 @@ public class HgPermissionBuilder
|
||||
|
||||
result.append("__").append(name).append(", ");
|
||||
|
||||
Group group = /*SCMContext.getContext().getGroupManager().get(name);*/ null;
|
||||
Group group = /* SCMContext.getContext().getGroupManager().get(name); */
|
||||
null;
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
|
||||
@@ -3,12 +3,19 @@
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -145,12 +152,12 @@ public class HgPermissionReader
|
||||
writePermissions.remove(readPerm);
|
||||
}
|
||||
|
||||
permissions.add(new Permission(readPerm, true, write, group));
|
||||
permissions.add(new Permission(readPerm, write, group));
|
||||
}
|
||||
|
||||
for (String writePerm : writePermissions)
|
||||
{
|
||||
permissions.add(new Permission(writePerm, false, true, group));
|
||||
permissions.add(new Permission(writePerm, true, group));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
@@ -15,7 +21,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@XmlRootElement(name="permissions")
|
||||
@XmlRootElement(name = "permissions")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class Permission
|
||||
{
|
||||
@@ -31,13 +37,11 @@ public class Permission
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @param readable
|
||||
* @param writeable
|
||||
*/
|
||||
public Permission(String name, boolean readable, boolean writeable)
|
||||
public Permission(String name, boolean writeable)
|
||||
{
|
||||
this.name = name;
|
||||
this.readable = readable;
|
||||
this.writeable = writeable;
|
||||
this.groupPermission = false;
|
||||
}
|
||||
@@ -47,19 +51,34 @@ public class Permission
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @param readable
|
||||
* @param writeable
|
||||
* @param groupPermission
|
||||
*/
|
||||
public Permission(String name, boolean readable, boolean writeable,
|
||||
boolean groupPermission)
|
||||
public Permission(String name, boolean writeable, boolean groupPermission)
|
||||
{
|
||||
this.name = name;
|
||||
this.readable = readable;
|
||||
this.writeable = writeable;
|
||||
this.groupPermission = groupPermission;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @param writeable
|
||||
* @param groupPermission
|
||||
* @param path
|
||||
*/
|
||||
public Permission(String name, boolean writeable, boolean groupPermission,
|
||||
String path)
|
||||
{
|
||||
this.name = name;
|
||||
this.writeable = writeable;
|
||||
this.groupPermission = groupPermission;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -80,18 +99,18 @@ public class Permission
|
||||
buffer.append(" (Group)");
|
||||
}
|
||||
|
||||
buffer.append(" - ");
|
||||
|
||||
if (readable)
|
||||
{
|
||||
buffer.append("r");
|
||||
}
|
||||
buffer.append(" - r");
|
||||
|
||||
if (writeable)
|
||||
{
|
||||
buffer.append("w");
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(path))
|
||||
{
|
||||
buffer.append(" ").append(path);
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
@@ -108,6 +127,17 @@ public class Permission
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -125,9 +155,9 @@ public class Permission
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isReadable()
|
||||
public boolean isRootPermission()
|
||||
{
|
||||
return readable;
|
||||
return Util.isEmpty(path);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,6 +171,19 @@ public class Permission
|
||||
return writeable;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param path
|
||||
*/
|
||||
public void setPath(String path)
|
||||
{
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@@ -150,7 +193,7 @@ public class Permission
|
||||
private String name;
|
||||
|
||||
/** Field description */
|
||||
private boolean readable;
|
||||
private String path = "";
|
||||
|
||||
/** Field description */
|
||||
private boolean writeable;
|
||||
|
||||
Reference in New Issue
Block a user