/* * Copyright 2007-2017 Charles du Jeu - Abstrium SAS * This file is part of Pydio. * * Pydio is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pydio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Pydio. If not, see . * * The latest code can be found at . */ import {RoleMessagesConsumerMixin} from '../util/MessagesMixin' import RightsSelector from './RightsSelector' export default React.createClass({ mixins:[RoleMessagesConsumerMixin], propTypes:{ id:React.PropTypes.string, label:React.PropTypes.string, role:React.PropTypes.object, roleParent:React.PropTypes.object, pluginsFilter:React.PropTypes.func, paramsFilter:React.PropTypes.func, toggleEdit:React.PropTypes.func, editMode:React.PropTypes.bool, titleOnly:React.PropTypes.bool, editOnly:React.PropTypes.bool, noParamsListEdit:React.PropTypes.bool, uniqueScope:React.PropTypes.bool, showModal:React.PropTypes.func, hideModal:React.PropTypes.func, Controller:React.PropTypes.object, showPermissionMask:React.PropTypes.bool, supportsFolderBrowsing:React.PropTypes.bool }, onAclChange:function(newValue, oldValue){ this.props.Controller.updateAcl(this.props.id, newValue); }, onMaskChange:function(values){ this.props.Controller.updateMask(this.props.id, values); }, getInitialState:function(){ return {displayMask: false}; }, toggleDisplayMask: function(){ this.setState({displayMask:!this.state.displayMask}); }, render: function(){ var wsId = this.props.id; var parentAcls = (this.props.roleParent && this.props.roleParent.ACL) ? this.props.roleParent.ACL : {}; var acls = (this.props.role && this.props.role.ACL) ? this.props.role.ACL : {}; var label = this.props.label; var inherited = false; if(!acls[wsId] && parentAcls[wsId]){ label += ' ('+ this.context.getPydioRoleMessage('38') +')'; inherited = true; } var secondLine, action; var aclString = acls[wsId] || parentAcls[wsId]; if(!aclString) aclString = ""; action = ; if(this.props.showPermissionMask && (aclString.indexOf('r') != -1 || aclString.indexOf('w') != -1 )){ var toggleButton = ; label = (
{label} {toggleButton}
); if(this.state.displayMask){ var parentMask = this.props.roleParent.MASKS && this.props.roleParent.MASKS[wsId] ? this.props.roleParent.MASKS[wsId] : {}; var mask = this.props.role.MASKS && this.props.role.MASKS[wsId] ? this.props.role.MASKS[wsId] : {}; action = null; var aclObject; if(aclString){ aclObject = { read:aclString.indexOf('r') != -1, write:aclString.indexOf('w') != -1 }; } if(this.props.supportsFolderBrowsing){ secondLine = ( ); }else{ secondLine = ( ); } } } return ( ); } });