I am trying to do something like this in Solidity as a modifier but it wont work.

modifier onlyManagement {

    require( msg.sender == management || msg.sender == owner );


function someFunction() public onlyManagement{
  // do something

I want to be able for the owner of the contract or the manager to have access to it.

  • This code is ok. Maybe the way of calling someFunction method is error~ – BinGoBinBin Aug 23 '17 at 9:21
  • The function works fine. The management is able to call it but not the owner. If I switch the positions in the require function the owner is able to call the contract but not the manager... For some reason the "||" operator doesnt work right. I also tried doing if ( msg.sender != management || msg.sender != owner) throw; It doesnt work either... the OR operator doesnt seem to work right – Dino Anastos Aug 23 '17 at 9:45
  • 1
    if ( msg.sender != management && msg.sender != owner) throw; there is && op~ – BinGoBinBin Aug 23 '17 at 9:52
  • 1
    I changed the compiler version to 4.11 in solidity browser and it now works... – Dino Anastos Aug 23 '17 at 9:54
  • Thank you for that Bin... I missed that one... As for the require... looks like the latest compiler is giving a problem so I went back to an earlier complier and it worked. – Dino Anastos Aug 23 '17 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.