| 3776 | |
| 3777 | |
| 3778 | Future<bool> Master::authorize( |
| 3779 | const Option<Principal>& principal, |
| 3780 | ActionObject&& actionObject) |
| 3781 | { |
| 3782 | if (authorizer.isNone()) { |
| 3783 | return true; |
| 3784 | } |
| 3785 | |
| 3786 | const Option<authorization::Subject> subject = createSubject(principal); |
| 3787 | |
| 3788 | authorization::Request request; |
| 3789 | |
| 3790 | if (subject.isSome()) { |
| 3791 | *request.mutable_subject() = *subject; |
| 3792 | } |
| 3793 | |
| 3794 | LOG(INFO) << "Authorizing" |
| 3795 | << (principal.isSome() |
| 3796 | ? " principal '" + stringify(*principal) + "'" |
| 3797 | : " ANY principal") |
| 3798 | << " to " << actionObject; |
| 3799 | |
| 3800 | request.set_action(actionObject.action()); |
| 3801 | if (actionObject.object().isSome()) { |
| 3802 | *request.mutable_object() = *(std::move(actionObject).object()); |
| 3803 | } |
| 3804 | |
| 3805 | return authorizer.get()->authorized(request); |
| 3806 | } |
| 3807 | |
| 3808 | |
| 3809 | Future<bool> Master::authorize( |
no test coverage detected