Allow org admin to access GetResources()

This commit is contained in:
Yang Luo 2022-12-03 00:57:11 +08:00
parent 27bd771fed
commit d13a307ad5
2 changed files with 13 additions and 6 deletions

View File

@ -40,6 +40,15 @@ func (c *ApiController) GetResources() {
value := c.Input().Get("value")
sortField := c.Input().Get("sortField")
sortOrder := c.Input().Get("sortOrder")
userObj, ok := c.RequireSignedInUser()
if !ok {
return
}
if userObj.IsAdmin {
user = ""
}
if limit == "" || page == "" {
c.Data["json"] = object.GetResources(owner, user)
c.ServeJSON()

View File

@ -210,16 +210,14 @@ class ResourceListPage extends BaseListPage {
if (record.fileType === "image") {
return (
<a target="_blank" rel="noreferrer" href={record.url}>
<img src={record.url} alt={record.name} width={100} />
<img src={record.url} alt={record.name} width={200} />
</a>
);
} else if (record.fileType === "video") {
return (
<div>
<video width={100} controls>
<source src={text} type="video/mp4" />
</video>
</div>
<video width={200} controls>
<source src={record.url} type="video/mp4" />
</video>
);
}
},