mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-06 20:30:52 +01:00
allow public repositories
This commit is contained in:
@@ -87,7 +87,8 @@ public class PermissionUtil
|
||||
|
||||
boolean result = false;
|
||||
|
||||
if (user.isAdmin())
|
||||
if (user.isAdmin()
|
||||
|| ((pt == PermissionType.READ) && repository.isPublicReadable()))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ 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.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
/**
|
||||
@@ -61,11 +61,6 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
*/
|
||||
@XmlRootElement(name = "repositories")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(propOrder =
|
||||
{
|
||||
"id", "type", "name", "contact", "description", "creationDate",
|
||||
"lastModified", "url", "permissions"
|
||||
})
|
||||
public class Repository
|
||||
implements TypedObject, Validateable, Cloneable, Serializable
|
||||
{
|
||||
@@ -284,6 +279,17 @@ public class Repository
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isPublicReadable()
|
||||
{
|
||||
return publicReadable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -377,6 +383,17 @@ public class Repository
|
||||
this.permissions = permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param publicReadable
|
||||
*/
|
||||
public void setPublicReadable(boolean publicReadable)
|
||||
{
|
||||
this.publicReadable = publicReadable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -424,6 +441,10 @@ public class Repository
|
||||
/** Field description */
|
||||
private List<Permission> permissions;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "public")
|
||||
private boolean publicReadable = false;
|
||||
|
||||
/** Field description */
|
||||
private String type;
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
|
||||
var repositoryStore = new Sonia.rest.JsonStore({
|
||||
url: restUrl + 'repositories.json',
|
||||
fields: [ 'id', 'name', 'type', 'contact', 'description', 'creationDate', 'url', 'permissions' ],
|
||||
fields: [ 'id', 'name', 'type', 'contact', 'description', 'creationDate', 'url', 'public', 'permissions' ],
|
||||
sortInfo: {
|
||||
field: 'name'
|
||||
}
|
||||
@@ -270,7 +270,8 @@ Sonia.repository.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
|
||||
allowBlank: false
|
||||
},
|
||||
{fieldLabel: 'Contact', name: 'contact', vtype: 'email'},
|
||||
{fieldLabel: 'Description', name: 'description', xtype: 'textarea'}
|
||||
{fieldLabel: 'Description', name: 'description', xtype: 'textarea'},
|
||||
{fieldLabel: 'Public', name: 'public', xtype: 'checkbox'}
|
||||
]
|
||||
},{
|
||||
id: 'permissionGrid',
|
||||
|
||||
Reference in New Issue
Block a user