contract Controlled is Ownable{

    constructor() public {
        setExclude(msg.sender);
    }

    // Flag that determines if the token is transferable or not.
    bool public transferEnabled = false;

    // flag that makes locked address effect
    bool public plockFlag=true;
    mapping(address => bool) locked;
    mapping(address => bool) exclude;

    // 控制全局全局锁
    function enableTransfer(bool _enable) public onlyOwner{
        transferEnabled = _enable;
    }

    // 控制个人锁功能
    function enableLockFlag(bool _enable) public onlyOwner returns (bool success){
        plockFlag = _enable;
        return true;
    }

    function addLock(address _addr) public onlyOwner returns (bool success){
        require(_addr!=msg.sender);
        locked[_addr] = true;
        return true;
    }

    function setExclude(address _addr) public onlyOwner returns (bool success){
        exclude[_addr] = true;
        return true;
    }

    function removeLock(address _addr) public onlyOwner returns (bool success){
        locked[_addr] = false;
        return true;
    }

    modifier transferAllowed(address _addr) {
        if (!exclude[_addr]) {
            // flase抛异常，并扣除gas消耗
            assert(transferEnabled);
            if(plockFlag){
                assert(!locked[_addr]);
            }
        }
        
        _;
    }

}
function enableLockFlag(bool _enable) public onlyOwner returns (bool success){
        plockFlag = _enable;
        return true;
    }
// 控制个人锁功能