Commit 24efb6eb authored by Matija Obreza's avatar Matija Obreza
Browse files

Fix: Permissions for images

parent 78e2b0be
......@@ -6,6 +6,7 @@ import { Permissions, IUserPermissions } from 'model/acl/ACL';
*/
class RepositoryFile implements IUserPermissions {
public _permissions: Permissions;
public _class: string;
public static clazz: string = 'org.genesys.filerepository.model.RepositoryFile';
public accessRights: string;
......
......@@ -4,6 +4,8 @@ import RepositoryFile from 'model/repository/RepositoryFile';
* Defined in Swagger as '#/definitions/RepositoryImage'
*/
class RepositoryImage extends RepositoryFile {
public static clazz: string = 'org.genesys.filerepository.model.RepositoryImage';
public format: string;
public height: number;
public orientation: string;
......
......@@ -5,14 +5,15 @@ import { translate } from 'react-i18next';
import RepositoryFile from 'model/repository/RepositoryFile';
// UI
import Card, {CardHeader, CardContent} from 'ui/common/Card';
import {Properties, PropertiesItem} from 'ui/common/Properties';
import Card, { CardHeader, CardContent } from 'ui/common/Card';
import { Properties, PropertiesItem } from 'ui/common/Properties';
import ActionButton from 'ui/common/buttons/ActionButton';
import Permissions from 'ui/common/permission/Permissions';
import PrettyDate from 'ui/common/time/PrettyDate';
import DownloadIcon from '@material-ui/icons/GetApp';
import withStyles from '@material-ui/core/styles/withStyles';
import Grid from '@material-ui/core/Grid';
import RepositoryImage from 'model/repository/RepositoryImage';
/*tslint:disable*/
const style = (theme) => ({
......@@ -80,6 +81,16 @@ const FileCard = ({file, classes, compact = false, edit = false, deleteFile, edi
return null;
}
// console.log('File', className, file);
// We have different types of Repository items, need to resolve to proper server class name
let className: string = RepositoryFile.clazz;
switch (file._class) {
case 'RepositoryImage':
className = RepositoryImage.clazz;
break;
}
return compact ? (
<Grid item xs={ 12 }>
<Card className={ classes.root }>
......@@ -100,7 +111,7 @@ const FileCard = ({file, classes, compact = false, edit = false, deleteFile, edi
<div className={ classes.actions }>
<span><ActionButton action={ () => editFile(file.uuid) } title={ t('common:action.edit') } /></span>
<span><ActionButton action={ () => deleteFile(file.uuid) } title={ t('common:action.delete') } /></span>
{ file && file._permissions.manage && <Permissions clazz={ RepositoryFile.clazz } id={ file.id } /> }
{ file && file._permissions.manage && <Permissions clazz={ className } id={ file.id } /> }
</div>
}
/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment