| 2781 | |
| 2782 | |
| 2783 | Future<Response> Master::Http::_teardown( |
| 2784 | const FrameworkID& id, |
| 2785 | const Option<Principal>& principal) const |
| 2786 | { |
| 2787 | Framework* framework = master->getFramework(id); |
| 2788 | |
| 2789 | if (framework == nullptr) { |
| 2790 | return BadRequest("No framework found with specified ID"); |
| 2791 | } |
| 2792 | |
| 2793 | // Skip authorization if no ACLs were provided to the master. |
| 2794 | if (master->authorizer.isNone()) { |
| 2795 | return __teardown(id); |
| 2796 | } |
| 2797 | |
| 2798 | authorization::Request teardown; |
| 2799 | teardown.set_action(authorization::TEARDOWN_FRAMEWORK); |
| 2800 | |
| 2801 | Option<authorization::Subject> subject = createSubject(principal); |
| 2802 | if (subject.isSome()) { |
| 2803 | teardown.mutable_subject()->CopyFrom(subject.get()); |
| 2804 | } |
| 2805 | |
| 2806 | if (framework->info.has_principal()) { |
| 2807 | teardown.mutable_object()->mutable_framework_info()->CopyFrom( |
| 2808 | framework->info); |
| 2809 | teardown.mutable_object()->set_value(framework->info.principal()); |
| 2810 | } |
| 2811 | |
| 2812 | return master->authorizer.get()->authorized(teardown) |
| 2813 | .then(defer(master->self(), [=](bool authorized) -> Future<Response> { |
| 2814 | if (!authorized) { |
| 2815 | return Forbidden(); |
| 2816 | } |
| 2817 | |
| 2818 | return __teardown(id); |
| 2819 | })); |
| 2820 | } |
| 2821 | |
| 2822 | |
| 2823 | Future<Response> Master::Http::__teardown(const FrameworkID& id) const |
nothing calls this directly
no test coverage detected