Commit 8bc2a89a authored by Matija Obreza's avatar Matija Obreza Committed by Viacheslav Pavlov
Browse files

Regenerated PermissionService, InfoService

- Moved ACL models to `model/acl`
parent b0054777
import {PermissionService} from 'service/PermissionService';
import {log} from 'utilities/debug';
import {SidPermissions} from 'model/acl.model';
import { log } from 'utilities/debug';
import { SidPermissions } from 'model/acl/ACL';
import PermissionService from 'service/genesys/PermissionService';
export const permissions = (clazz: string, id: number) => (dispatch, getState) => {
return PermissionService.permissions(clazz, id)
.catch((error) => {
log('Error', error);
});
return PermissionService.permissions(clazz, id)
.catch((error) => {
log('Error', error);
});
};
export const addPermission = (clazz: string, id: number, sidPermissions: SidPermissions) => (dispatch, getState) => {
return PermissionService.addPermission(clazz, id, sidPermissions)
.catch((error) => {
log('Error', error);
});
return PermissionService.addPermission(clazz, id, sidPermissions)
.catch((error) => {
log('Error', error);
});
};
export const autocomplete = (term: string) => (dispatch, getState) => {
return PermissionService.autocomplete(term)
.catch((error) => {
log('Error', error);
});
return PermissionService.acSid(term)
.catch((error) => {
log('Error', error);
});
};
import * as Constants from 'constants/serverInfo';
import {log} from 'utilities/debug';
import {InfoService} from 'service/InfoService';
import ServerInfo from 'model/serverinfo.model';
import ApiInfo from 'model/ApiInfo';
import ApiInfoService from 'service/genesys/ApiInfoService';
export const serverInfoRequest = () => (dispatch, getState): Promise<ServerInfo> => {
return InfoService.getServerInfo()
export const serverInfoRequest = () => (dispatch, getState): Promise<ApiInfo> => {
return ApiInfoService.apiInfo()
.then((data) => dispatch(getServerInfo(data)))
.catch((error) => log('Error', error));
};
const getServerInfo = (info: ServerInfo) => ({
const getServerInfo = (info: ApiInfo) => ({
type: Constants.GET_SERVER_INFO,
payload: { info },
});
class ServerInfo {
public artifactId: string;
public version: string;
public revision: string;
public hostName: string;
public cdnServers: string;
/*
* Defined in Swagger as '#/definitions/ApiInfo'
*/
class ApiInfo {
public accessionCount: number;
public artifactId: string;
public baseUrl: string;
public captchaSiteKey: string;
public cdnServers: string[];
public datasetCount: number;
public subsetCount: number;
public instituteCount: number;
public descriptorCount: number;
public descriptorListCount: number;
public glisUrl: string;
public googleAnalyticsId: string;
public instituteCount: number;
public partnerCount: number;
public revision: string;
public subsetCount: number;
public version: string;
}
export default ServerInfo;
export default ApiInfo;
import {AuditedVersionedModel, BasicModel} from 'model/common.model';
export class AclSid extends AuditedVersionedModel {
public principal: boolean;
public sid: string;
public objectIdentities: AclObjectIdentity[];
public aclEntries: AclEntry[];
public constructor(obj?) {
super(obj);
}
public getClassname(): string {
return 'org.genesys.blocks.security.model.AclSid';
}
}
export class AclObjectIdentity extends BasicModel {
public aclClass: AclClass;
public parentObject: AclObjectIdentity;
public ownerSid: AclSid;
public objectIdIdentity: number;
public entriesInheriting: boolean;
public aclEntries: SidPermissions[];
public constructor(obj?) {
super(obj);
}
public getClassname(): string {
return 'org.genesys.blocks.security.model.AclObjectIdentity';
}
}
export class AclEntry extends BasicModel {
public aclObjectIdentity: AclObjectIdentity;
public aclSid: AclSid;
public aceOrder: number;
public mask: number;
public granting: boolean;
public auditSuccess: boolean;
public auditFailure: boolean;
public constructor(obj?) {
super(obj);
}
public getClassname(): string {
return 'org.genesys.blocks.security.model.AclEntry';
}
}
export class AclClass extends BasicModel {
public aclClass: string;
public constructor(obj?) {
super(obj);
}
public getClassname(): string {
return 'org.genesys.blocks.security.model.AclClass';
}
}
import AclSid from 'model/acl/AclSid';
export class Permissions {
public create: boolean;
......@@ -93,7 +31,7 @@ export class Permissions {
}
export class SidPermissions extends Permissions {
public sid: AclSid;
public sid: AclSid | string;
public getClassname(): string {
return 'org.genesys.blocks.security.serialization.SidPermissions';
......
/*
* Defined in Swagger as '#/definitions/AclClass'
*/
class AclClass {
public aclClass: string;
public id: number;
}
export default AclClass;
import AclSid from 'model/acl/AclSid';
/*
* Defined in Swagger as '#/definitions/AclEntry'
*/
class AclEntry {
public aceOrder: number;
public aclSid: AclSid;
public auditFailure: boolean;
public auditSuccess: boolean;
public granting: boolean;
public id: number;
public mask: number;
}
export default AclEntry;
import AclClass from 'model/acl/AclClass';
import AclSid from 'model/acl/AclSid';
import { SidPermissions } from 'model/acl/ACL';
/*
* Defined in Swagger as '#/definitions/AclObjectIdentityExt'
*/
class AclObjectIdentity {
public aclClass: AclClass;
public aclEntries: SidPermissions[];
public entriesInheriting: boolean;
public id: number;
public inherited: SidPermissions[];
public objectIdIdentity: number;
public ownerSid: AclSid;
public parentObject: AclObjectIdentity;
}
export default AclObjectIdentity;
/*
* Defined in Swagger as '#/definitions/AclSid'
*/
class AclSid {
public active: boolean;
public createdBy: number;
public createdDate: Date;
public fullName: string;
public id: number;
public lastModifiedBy: number;
public lastModifiedDate: Date;
public principal: boolean;
public sid: string;
public version: number;
}
export default AclSid;
import RepositoryImage from 'model/repository/RepositoryImage';
import { Permissions, IUserPermissions } from 'model/acl.model';
import { Permissions, IUserPermissions } from 'model/acl/ACL';
/*
* Defined in Swagger as '#/definitions/ImageGallery'
......
import RepositoryFolder from 'model/repository/RepositoryFolder';
import { Permissions, IUserPermissions } from 'model/acl.model';
import { Permissions, IUserPermissions } from 'model/acl/ACL';
/*
* Defined in Swagger as '#/definitions/RepositoryFile'
......
import { IUserPermissions, Permissions } from 'model/acl.model';
import { IUserPermissions, Permissions } from 'model/acl/ACL';
/*
* Defined in Swagger as '#/definitions/RepositoryFolder'
......
import ServerInfo from 'model/serverinfo.model';
import { axiosBackend } from 'utilities/requestUtils';
export const SERVER_INFO_URL = `/api/v1/info/version`;
export class InfoService {
public static getServerInfo(): Promise<ServerInfo> {
return axiosBackend.request({
url: SERVER_INFO_URL,
method: 'GET',
}).then(({data}) => data as ServerInfo);
}
}
import {AclObjectIdentity, SidPermissions} from 'model/acl.model';
import { axiosBackend } from 'utilities/requestUtils';
import {APIv1_BASE_URL} from 'constants/apiURLS';
// import {log} from 'utilities/debug';
const API_URL = `${APIv1_BASE_URL}/permission`;
export class PermissionService {
public static permissions(clazz: string, id: number): Promise<AclObjectIdentity> {
return axiosBackend.request({
url: `${API_URL}/permissions/${clazz}/${id}`,
method: 'GET',
}).then(({data}) => new AclObjectIdentity(data));
}
public static addPermission(clazz: string, id: number, sidPermissions: SidPermissions): Promise<AclObjectIdentity> {
return axiosBackend.request({
url: `${API_URL}/permissions/${clazz}/${id}`,
method: 'POST',
data: {
...sidPermissions,
},
}).then(({data}) => new AclObjectIdentity(data));
}
public static autocomplete(term: string): Promise<{[key: string]: number}> {
return axiosBackend.request({
url: `${API_URL}/autocomplete?term=${term}`,
method: 'GET',
}).then(({data}) => data);
}
}
import { axiosBackend } from 'utilities/requestUtils';
import ApiInfo from 'model/ApiInfo';
const URL_API_INFO = `/api/v1/info/version`;
/*
* Defined in Swagger as 'api-info'
*/
class ApiInfoService {
/**
* apiInfo at /api/v1/info/version
*
*/
public static apiInfo(): Promise<ApiInfo> {
const apiUrl = URL_API_INFO;
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
return axiosBackend({
url: apiUrl,
method: 'GET',
...content,
}).then(({ data }) => data as ApiInfo);
}
}
export default ApiInfoService;
import * as UrlTemplate from 'url-template';
import * as QueryString from 'query-string';
import { axiosBackend } from 'utilities/requestUtils';
import AclObjectIdentity from 'model/acl/AclObjectIdentity';
import { SidPermissions } from 'model/acl/ACL';
const URL_AC_SID = `/api/v1/permission/autocomplete`;
const URL_AC_OAUTH_CLIENT = `/api/v1/permission/autocomplete-oauth-client`;
const URL_AC_ROLE = `/api/v1/permission/autocompleterole`;
const URL_AC_USER = `/api/v1/permission/autocompleteuser`;
const URL_PERMISSIONS = UrlTemplate.parse(`/api/v1/permission/permissions/{clazz}/{id}`);
const URL_ADD_PERMISSION = UrlTemplate.parse(`/api/v1/permission/permissions/{clazz}/{id}`);
/*
* Defined in Swagger as 'permission'
*/
class PermissionService {
/**
* acSid at /api/v1/permission/autocomplete
*
* @param term term
*/
public static acSid(term: string): Promise<any> {
const qs = QueryString.stringify({
term: term || undefined,
}, {});
const apiUrl = URL_AC_SID + (qs ? `?${qs}` : '');
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
return axiosBackend({
url: apiUrl,
method: 'GET',
...content,
}).then(({ data }) => data as any);
}
/**
* acOauthClient at /api/v1/permission/autocomplete-oauth-client
*
* @param term term
* @deprecated
*/
public static acOauthClient(term: string): Promise<any> {
const qs = QueryString.stringify({
term: term || undefined,
}, {});
const apiUrl = URL_AC_OAUTH_CLIENT + (qs ? `?${qs}` : '');
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
return axiosBackend({
url: apiUrl,
method: 'GET',
...content,
}).then(({ data }) => data as any);
}
/**
* acRole at /api/v1/permission/autocompleterole
*
* @param term term
* @deprecated
*/
public static acRole(term: string): Promise<any> {
const qs = QueryString.stringify({
term: term || undefined,
}, {});
const apiUrl = URL_AC_ROLE + (qs ? `?${qs}` : '');
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
return axiosBackend({
url: apiUrl,
method: 'GET',
...content,
}).then(({ data }) => data as any);
}
/**
* acUser at /api/v1/permission/autocompleteuser
*
* @param term term
* @deprecated
*/
public static acUser(term: string): Promise<any> {
const qs = QueryString.stringify({
term: term || undefined,
}, {});
const apiUrl = URL_AC_USER + (qs ? `?${qs}` : '');
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
return axiosBackend({
url: apiUrl,
method: 'GET',
...content,
}).then(({ data }) => data as any);
}
/**
* permissions at /api/v1/permission/permissions/{clazz}/{id}
*
* @param clazz clazz
* @param id id
*/
public static permissions(clazz: string, id: number): Promise<AclObjectIdentity> {
const apiUrl = URL_PERMISSIONS.expand({clazz, id});
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
return axiosBackend({
url: apiUrl,
method: 'GET',
...content,
}).then(({ data }) => data as AclObjectIdentity);
}
/**
* addPermission at /api/v1/permission/permissions/{clazz}/{id}
*
* @param clazz clazz
* @param id id
* @param sidPermissions sidPermissions
*/
public static addPermission(clazz: string, id: number, sidPermissions: SidPermissions): Promise<AclObjectIdentity> {
const apiUrl = URL_ADD_PERMISSION.expand({clazz, id});
// console.log(`Fetching from ${apiUrl}`);
const content = { data: sidPermissions };
return axiosBackend({
url: apiUrl,
method: 'POST',
...content,
}).then(({ data }) => data as AclObjectIdentity);
}
}
export default PermissionService;
import * as React from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Button from '@material-ui/core/Button';
import Dialog from '@material-ui/core/Dialog';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import {permissions, addPermission, autocomplete} from 'actions/permission';
import {AclEntry, AclObjectIdentity, SidPermissions} from 'model/acl.model';
import { permissions, addPermission, autocomplete } from 'actions/permission';
import { SidPermissions } from 'model/acl/ACL';
import Loading from 'ui/common/Loading';
import {Properties, PropertiesItem} from 'ui/common/Properties';
import { Properties, PropertiesItem } from 'ui/common/Properties';
import PermissionsTableForm from 'ui/common/permission/PermissionsTableForm';
import AclObjectIdentity from 'model/acl/AclObjectIdentity';
import AclEntry from 'model/acl/AclEntry';
interface IPermissionsProps extends React.ClassAttributes<any> {
clazz: string;
......
import * as React from 'react';
import {Field, FieldArray, reduxForm} from 'redux-form';
import {withStyles} from '@material-ui/core/styles';
import { Field, FieldArray, reduxForm } from 'redux-form';
import { withStyles } from '@material-ui/core/styles';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
......@@ -8,10 +8,11 @@ import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import Button from '@material-ui/core/Button';
import {PERMISSION_TABLE_FORM} from 'constants/permission';
import { PERMISSION_TABLE_FORM } from 'constants/permission';
import ReduxCheckbox from 'ui/common/checkbox';
import {AclObjectIdentity, Permissions, SidPermissions} from 'model/acl.model';
import { Permissions, SidPermissions } from 'model/acl/ACL';
import MaterialAutosuggest from 'ui/common/material-autosuggest';
import AclObjectIdentity from 'model/acl/AclObjectIdentity';
interface IPermissionsTableFormProps extends React.ClassAttributes<any> {
classes: any;
......
Supports Markdown
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