| 1910 | |
| 1911 | |
| 1912 | process::Future<bool> LocalAuthorizer::authorized( |
| 1913 | const authorization::Request& request) |
| 1914 | { |
| 1915 | // Request sanity checks. |
| 1916 | // A set `subject` should always come with a set `value` or `claims`. |
| 1917 | CHECK( |
| 1918 | !request.has_subject() || |
| 1919 | request.subject().has_value() || |
| 1920 | request.subject().has_claims()); |
| 1921 | |
| 1922 | // A set `action` is mandatory. |
| 1923 | CHECK(request.has_action()); |
| 1924 | |
| 1925 | // A set `object` should always come with at least one set union |
| 1926 | // style value. |
| 1927 | CHECK( |
| 1928 | !request.has_object() || |
| 1929 | (request.has_object() && |
| 1930 | (request.object().has_value() || |
| 1931 | request.object().has_framework_info() || |
| 1932 | request.object().has_task() || |
| 1933 | request.object().has_task_info() || |
| 1934 | request.object().has_executor_info() || |
| 1935 | request.object().has_quota_info() || |
| 1936 | request.object().has_weight_info() || |
| 1937 | request.object().has_container_id() || |
| 1938 | request.object().has_resource()))); |
| 1939 | |
| 1940 | typedef Future<bool> (LocalAuthorizerProcess::*F)( |
| 1941 | const authorization::Request&); |
| 1942 | |
| 1943 | return dispatch( |
| 1944 | process, |
| 1945 | static_cast<F>(&LocalAuthorizerProcess::authorized), |
| 1946 | request); |
| 1947 | } |
| 1948 | |
| 1949 | |
| 1950 | Future<shared_ptr<const ObjectApprover>> LocalAuthorizer::getApprover( |
no test coverage detected