mirror of
https://github.com/ascribe/onion.git
synced 2024-06-30 21:52:08 +02:00
acl indexof
This commit is contained in:
parent
6e1cf55841
commit
fd2f99f1b0
|
@ -120,7 +120,7 @@ ${this.props.currentUser.username}
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let shouldDisplay = this.props.availableAcls.indexOf(this.props.action) > -1;
|
let shouldDisplay = this.props.availableAcls[this.props.action];
|
||||||
let aclProps = this.actionProperties();
|
let aclProps = this.actionProperties();
|
||||||
return (
|
return (
|
||||||
<ModalWrapper
|
<ModalWrapper
|
||||||
|
|
|
@ -67,7 +67,7 @@ let CreateEditionsButton = React.createClass({
|
||||||
|
|
||||||
let availableAcls = getAvailableAcls(piece);
|
let availableAcls = getAvailableAcls(piece);
|
||||||
|
|
||||||
if (availableAcls.indexOf('editions') < -1 || piece.num_editions > 0){
|
if (availableAcls.editions || piece.num_editions > 0){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,11 @@ let DeleteButton = React.createClass({
|
||||||
let btnDelete = null;
|
let btnDelete = null;
|
||||||
let content = null;
|
let content = null;
|
||||||
|
|
||||||
if (availableAcls.indexOf('delete') > -1) {
|
if (availableAcls.delete) {
|
||||||
content = <EditionDeleteForm editions={ this.props.editions }/>;
|
content = <EditionDeleteForm editions={ this.props.editions }/>;
|
||||||
btnDelete = <Button bsStyle="danger" className="btn-delete" bsSize="small">{getLangText('DELETE')}</Button>;
|
btnDelete = <Button bsStyle="danger" className="btn-delete" bsSize="small">{getLangText('DELETE')}</Button>;
|
||||||
}
|
}
|
||||||
else if (availableAcls.indexOf('del_from_collection') > -1){
|
else if (availableAcls.unshare){
|
||||||
content = <EditionRemoveFromCollectionForm editions={ this.props.editions }/>;
|
content = <EditionRemoveFromCollectionForm editions={ this.props.editions }/>;
|
||||||
btnDelete = <Button bsStyle="danger" className="btn-delete" bsSize="small">{getLangText('REMOVE FROM COLLECTION')}</Button>;
|
btnDelete = <Button bsStyle="danger" className="btn-delete" bsSize="small">{getLangText('REMOVE FROM COLLECTION')}</Button>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ let Edition = React.createClass({
|
||||||
|
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title={getLangText('Certificate of Authenticity')}
|
title={getLangText('Certificate of Authenticity')}
|
||||||
show={this.props.edition.acl.indexOf('coa') > -1}>
|
show={this.props.edition.acl.acl_coa}>
|
||||||
<CoaDetails
|
<CoaDetails
|
||||||
edition={this.props.edition}/>
|
edition={this.props.edition}/>
|
||||||
</CollapsibleParagraph>
|
</CollapsibleParagraph>
|
||||||
|
@ -114,7 +114,7 @@ let Edition = React.createClass({
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title="Notes"
|
title="Notes"
|
||||||
show={(this.state.currentUser.username && true || false) ||
|
show={(this.state.currentUser.username && true || false) ||
|
||||||
(this.props.edition.acl.indexOf('edit') > -1 || this.props.edition.public_note)}>
|
(this.props.edition.acl.acl_edit || this.props.edition.public_note)}>
|
||||||
<EditionPersonalNote
|
<EditionPersonalNote
|
||||||
currentUser={this.state.currentUser}
|
currentUser={this.state.currentUser}
|
||||||
handleSuccess={this.props.loadEdition}
|
handleSuccess={this.props.loadEdition}
|
||||||
|
@ -126,11 +126,11 @@ let Edition = React.createClass({
|
||||||
|
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title={getLangText('Further Details')}
|
title={getLangText('Further Details')}
|
||||||
show={this.props.edition.acl.indexOf('edit') > -1
|
show={this.props.edition.acl.acl_edit
|
||||||
|| Object.keys(this.props.edition.extra_data).length > 0
|
|| Object.keys(this.props.edition.extra_data).length > 0
|
||||||
|| this.props.edition.other_data !== null}>
|
|| this.props.edition.other_data !== null}>
|
||||||
<EditionFurtherDetails
|
<EditionFurtherDetails
|
||||||
editable={this.props.edition.acl.indexOf('edit') > -1}
|
editable={this.props.edition.acl.acl_edit}
|
||||||
pieceId={this.props.edition.parent}
|
pieceId={this.props.edition.parent}
|
||||||
extraData={this.props.edition.extra_data}
|
extraData={this.props.edition.extra_data}
|
||||||
otherData={this.props.edition.other_data}
|
otherData={this.props.edition.other_data}
|
||||||
|
@ -170,7 +170,7 @@ let EditionSummary = React.createClass({
|
||||||
if (this.props.edition.status.length > 0){
|
if (this.props.edition.status.length > 0){
|
||||||
let statusStr = this.props.edition.status.join().replace(/_/, ' ');
|
let statusStr = this.props.edition.status.join().replace(/_/, ' ');
|
||||||
status = <EditionDetailProperty label="STATUS" value={ statusStr }/>;
|
status = <EditionDetailProperty label="STATUS" value={ statusStr }/>;
|
||||||
if (this.props.edition.pending_new_owner && this.props.edition.acl.indexOf('withdraw_transfer') > -1){
|
if (this.props.edition.pending_new_owner && this.props.edition.acl.acl_withdraw_transfer){
|
||||||
status = (
|
status = (
|
||||||
<Form
|
<Form
|
||||||
url={apiUrls.ownership_transfers_withdraw}
|
url={apiUrls.ownership_transfers_withdraw}
|
||||||
|
@ -304,8 +304,8 @@ let EditionPublicEditionNote = React.createClass({
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
let isEditable = this.props.edition.acl.indexOf('edit') > -1;
|
let isEditable = this.props.edition.acl.acl_edit;
|
||||||
if (this.props.edition.acl.indexOf('edit') > -1 || this.props.edition.public_note){
|
if (isEditable || this.props.edition.public_note){
|
||||||
return (
|
return (
|
||||||
<Form
|
<Form
|
||||||
url={apiUrls.note_edition}
|
url={apiUrls.note_edition}
|
||||||
|
|
|
@ -126,12 +126,12 @@ let Piece = React.createClass({
|
||||||
|
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title="Further Details"
|
title="Further Details"
|
||||||
show={this.props.piece.acl.indexOf('edit') > -1
|
show={this.props.piece.acl.acl_edit
|
||||||
|| Object.keys(this.props.piece.extra_data).length > 0
|
|| Object.keys(this.props.piece.extra_data).length > 0
|
||||||
|| this.props.piece.other_data !== null}
|
|| this.props.piece.other_data !== null}
|
||||||
defaultExpanded={true}>
|
defaultExpanded={true}>
|
||||||
<FurtherDetails
|
<FurtherDetails
|
||||||
editable={this.props.piece.acl.indexOf('edit') > -1}
|
editable={this.props.piece.acl.acl_edit}
|
||||||
pieceId={this.props.piece.id}
|
pieceId={this.props.piece.id}
|
||||||
extraData={this.props.piece.extra_data}
|
extraData={this.props.piece.extra_data}
|
||||||
otherData={this.props.piece.other_data}
|
otherData={this.props.piece.other_data}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user