Browse code

add what-can-i-do endpoint

deads2k authored on 2016/04/29 05:21:37
Showing 32 changed files
... ...
@@ -15686,6 +15686,102 @@
15686 15686
     ]
15687 15687
    },
15688 15688
    {
15689
+    "path": "/oapi/v1/namespaces/{namespace}/selfsubjectrulesreviews",
15690
+    "description": "OpenShift REST API, version v1",
15691
+    "operations": [
15692
+     {
15693
+      "type": "v1.SelfSubjectRulesReview",
15694
+      "method": "POST",
15695
+      "summary": "create a SelfSubjectRulesReview",
15696
+      "nickname": "createNamespacedSelfSubjectRulesReview",
15697
+      "parameters": [
15698
+       {
15699
+        "type": "string",
15700
+        "paramType": "query",
15701
+        "name": "pretty",
15702
+        "description": "If 'true', then the output is pretty printed.",
15703
+        "required": false,
15704
+        "allowMultiple": false
15705
+       },
15706
+       {
15707
+        "type": "v1.SelfSubjectRulesReview",
15708
+        "paramType": "body",
15709
+        "name": "body",
15710
+        "description": "",
15711
+        "required": true,
15712
+        "allowMultiple": false
15713
+       },
15714
+       {
15715
+        "type": "string",
15716
+        "paramType": "path",
15717
+        "name": "namespace",
15718
+        "description": "object name and auth scope, such as for teams and projects",
15719
+        "required": true,
15720
+        "allowMultiple": false
15721
+       }
15722
+      ],
15723
+      "responseMessages": [
15724
+       {
15725
+        "code": 200,
15726
+        "message": "OK",
15727
+        "responseModel": "v1.SelfSubjectRulesReview"
15728
+       }
15729
+      ],
15730
+      "produces": [
15731
+       "application/json",
15732
+       "application/yaml"
15733
+      ],
15734
+      "consumes": [
15735
+       "*/*"
15736
+      ]
15737
+     }
15738
+    ]
15739
+   },
15740
+   {
15741
+    "path": "/oapi/v1/selfsubjectrulesreviews",
15742
+    "description": "OpenShift REST API, version v1",
15743
+    "operations": [
15744
+     {
15745
+      "type": "v1.SelfSubjectRulesReview",
15746
+      "method": "POST",
15747
+      "summary": "create a SelfSubjectRulesReview",
15748
+      "nickname": "createNamespacedSelfSubjectRulesReview",
15749
+      "parameters": [
15750
+       {
15751
+        "type": "string",
15752
+        "paramType": "query",
15753
+        "name": "pretty",
15754
+        "description": "If 'true', then the output is pretty printed.",
15755
+        "required": false,
15756
+        "allowMultiple": false
15757
+       },
15758
+       {
15759
+        "type": "v1.SelfSubjectRulesReview",
15760
+        "paramType": "body",
15761
+        "name": "body",
15762
+        "description": "",
15763
+        "required": true,
15764
+        "allowMultiple": false
15765
+       }
15766
+      ],
15767
+      "responseMessages": [
15768
+       {
15769
+        "code": 200,
15770
+        "message": "OK",
15771
+        "responseModel": "v1.SelfSubjectRulesReview"
15772
+       }
15773
+      ],
15774
+      "produces": [
15775
+       "application/json",
15776
+       "application/yaml"
15777
+      ],
15778
+      "consumes": [
15779
+       "*/*"
15780
+      ]
15781
+     }
15782
+    ]
15783
+   },
15784
+   {
15689 15785
     "path": "/oapi/v1/namespaces/{namespace}/subjectaccessreviews",
15690 15786
     "description": "OpenShift REST API, version v1",
15691 15787
     "operations": [
... ...
@@ -22610,6 +22706,44 @@
22610 22610
      }
22611 22611
     }
22612 22612
    },
22613
+   "v1.SelfSubjectRulesReview": {
22614
+    "id": "v1.SelfSubjectRulesReview",
22615
+    "description": "SelfSubjectRulesReview is a resource you can create to determine which actions you can perform in a namespace",
22616
+    "properties": {
22617
+     "kind": {
22618
+      "type": "string",
22619
+      "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
22620
+     },
22621
+     "apiVersion": {
22622
+      "type": "string",
22623
+      "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
22624
+     },
22625
+     "status": {
22626
+      "$ref": "v1.SubjectRulesReviewStatus",
22627
+      "description": "Status is completed by the server to tell which permissions you have"
22628
+     }
22629
+    }
22630
+   },
22631
+   "v1.SubjectRulesReviewStatus": {
22632
+    "id": "v1.SubjectRulesReviewStatus",
22633
+    "description": "SubjectRulesReviewStatus is contains the result of a rules check",
22634
+    "required": [
22635
+     "rules"
22636
+    ],
22637
+    "properties": {
22638
+     "rules": {
22639
+      "type": "array",
22640
+      "items": {
22641
+       "$ref": "v1.PolicyRule"
22642
+      },
22643
+      "description": "Rules is the list of rules (no particular sort) that are allowed for the subject"
22644
+     },
22645
+     "evaluationError": {
22646
+      "type": "string",
22647
+      "description": "EvaluationError can appear in combination with Rules.  It means some error happened during evaluation that may have prevented additional rules from being populated."
22648
+     }
22649
+    }
22650
+   },
22613 22651
    "v1.SubjectAccessReview": {
22614 22652
     "id": "v1.SubjectAccessReview",
22615 22653
     "description": "SubjectAccessReview is an object for requesting information about whether a user or group can perform an action",
... ...
@@ -7216,6 +7216,46 @@ _oc_policy_who-can()
7216 7216
     must_have_one_noun=()
7217 7217
 }
7218 7218
 
7219
+_oc_policy_what-can-i-do()
7220
+{
7221
+    last_command="oc_policy_what-can-i-do"
7222
+    commands=()
7223
+
7224
+    flags=()
7225
+    two_word_flags=()
7226
+    flags_with_completion=()
7227
+    flags_completion=()
7228
+
7229
+    flags+=("--api-version=")
7230
+    flags+=("--as=")
7231
+    flags+=("--certificate-authority=")
7232
+    flags_with_completion+=("--certificate-authority")
7233
+    flags_completion+=("_filedir")
7234
+    flags+=("--client-certificate=")
7235
+    flags_with_completion+=("--client-certificate")
7236
+    flags_completion+=("_filedir")
7237
+    flags+=("--client-key=")
7238
+    flags_with_completion+=("--client-key")
7239
+    flags_completion+=("_filedir")
7240
+    flags+=("--cluster=")
7241
+    flags+=("--config=")
7242
+    flags_with_completion+=("--config")
7243
+    flags_completion+=("_filedir")
7244
+    flags+=("--context=")
7245
+    flags+=("--google-json-key=")
7246
+    flags+=("--insecure-skip-tls-verify")
7247
+    flags+=("--log-flush-frequency=")
7248
+    flags+=("--match-server-version")
7249
+    flags+=("--namespace=")
7250
+    two_word_flags+=("-n")
7251
+    flags+=("--server=")
7252
+    flags+=("--token=")
7253
+    flags+=("--user=")
7254
+
7255
+    must_have_one_flag=()
7256
+    must_have_one_noun=()
7257
+}
7258
+
7219 7259
 _oc_policy_add-role-to-user()
7220 7260
 {
7221 7261
     last_command="oc_policy_add-role-to-user"
... ...
@@ -7469,6 +7509,7 @@ _oc_policy()
7469 7469
     last_command="oc_policy"
7470 7470
     commands=()
7471 7471
     commands+=("who-can")
7472
+    commands+=("what-can-i-do")
7472 7473
     commands+=("add-role-to-user")
7473 7474
     commands+=("remove-role-from-user")
7474 7475
     commands+=("remove-user")
... ...
@@ -10801,6 +10801,46 @@ _openshift_cli_policy_who-can()
10801 10801
     must_have_one_noun=()
10802 10802
 }
10803 10803
 
10804
+_openshift_cli_policy_what-can-i-do()
10805
+{
10806
+    last_command="openshift_cli_policy_what-can-i-do"
10807
+    commands=()
10808
+
10809
+    flags=()
10810
+    two_word_flags=()
10811
+    flags_with_completion=()
10812
+    flags_completion=()
10813
+
10814
+    flags+=("--api-version=")
10815
+    flags+=("--as=")
10816
+    flags+=("--certificate-authority=")
10817
+    flags_with_completion+=("--certificate-authority")
10818
+    flags_completion+=("_filedir")
10819
+    flags+=("--client-certificate=")
10820
+    flags_with_completion+=("--client-certificate")
10821
+    flags_completion+=("_filedir")
10822
+    flags+=("--client-key=")
10823
+    flags_with_completion+=("--client-key")
10824
+    flags_completion+=("_filedir")
10825
+    flags+=("--cluster=")
10826
+    flags+=("--config=")
10827
+    flags_with_completion+=("--config")
10828
+    flags_completion+=("_filedir")
10829
+    flags+=("--context=")
10830
+    flags+=("--google-json-key=")
10831
+    flags+=("--insecure-skip-tls-verify")
10832
+    flags+=("--log-flush-frequency=")
10833
+    flags+=("--match-server-version")
10834
+    flags+=("--namespace=")
10835
+    two_word_flags+=("-n")
10836
+    flags+=("--server=")
10837
+    flags+=("--token=")
10838
+    flags+=("--user=")
10839
+
10840
+    must_have_one_flag=()
10841
+    must_have_one_noun=()
10842
+}
10843
+
10804 10844
 _openshift_cli_policy_add-role-to-user()
10805 10845
 {
10806 10846
     last_command="openshift_cli_policy_add-role-to-user"
... ...
@@ -11054,6 +11094,7 @@ _openshift_cli_policy()
11054 11054
     last_command="openshift_cli_policy"
11055 11055
     commands=()
11056 11056
     commands+=("who-can")
11057
+    commands+=("what-can-i-do")
11057 11058
     commands+=("add-role-to-user")
11058 11059
     commands+=("remove-role-from-user")
11059 11060
     commands+=("remove-user")
... ...
@@ -632,6 +632,18 @@ func deepCopy_api_RoleList(in api.RoleList, out *api.RoleList, c *conversion.Clo
632 632
 	return nil
633 633
 }
634 634
 
635
+func deepCopy_api_SelfSubjectRulesReview(in api.SelfSubjectRulesReview, out *api.SelfSubjectRulesReview, c *conversion.Cloner) error {
636
+	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
637
+		return err
638
+	} else {
639
+		out.TypeMeta = newVal.(unversioned.TypeMeta)
640
+	}
641
+	if err := deepCopy_api_SubjectRulesReviewStatus(in.Status, &out.Status, c); err != nil {
642
+		return err
643
+	}
644
+	return nil
645
+}
646
+
635 647
 func deepCopy_api_SubjectAccessReview(in api.SubjectAccessReview, out *api.SubjectAccessReview, c *conversion.Cloner) error {
636 648
 	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
637 649
 		return err
... ...
@@ -669,6 +681,21 @@ func deepCopy_api_SubjectAccessReviewResponse(in api.SubjectAccessReviewResponse
669 669
 	return nil
670 670
 }
671 671
 
672
+func deepCopy_api_SubjectRulesReviewStatus(in api.SubjectRulesReviewStatus, out *api.SubjectRulesReviewStatus, c *conversion.Cloner) error {
673
+	if in.Rules != nil {
674
+		out.Rules = make([]api.PolicyRule, len(in.Rules))
675
+		for i := range in.Rules {
676
+			if err := deepCopy_api_PolicyRule(in.Rules[i], &out.Rules[i], c); err != nil {
677
+				return err
678
+			}
679
+		}
680
+	} else {
681
+		out.Rules = nil
682
+	}
683
+	out.EvaluationError = in.EvaluationError
684
+	return nil
685
+}
686
+
672 687
 func deepCopy_api_BinaryBuildRequestOptions(in buildapi.BinaryBuildRequestOptions, out *buildapi.BinaryBuildRequestOptions, c *conversion.Cloner) error {
673 688
 	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
674 689
 		return err
... ...
@@ -3316,8 +3343,10 @@ func init() {
3316 3316
 		deepCopy_api_RoleBinding,
3317 3317
 		deepCopy_api_RoleBindingList,
3318 3318
 		deepCopy_api_RoleList,
3319
+		deepCopy_api_SelfSubjectRulesReview,
3319 3320
 		deepCopy_api_SubjectAccessReview,
3320 3321
 		deepCopy_api_SubjectAccessReviewResponse,
3322
+		deepCopy_api_SubjectRulesReviewStatus,
3321 3323
 		deepCopy_api_BinaryBuildRequestOptions,
3322 3324
 		deepCopy_api_BinaryBuildSource,
3323 3325
 		deepCopy_api_Build,
... ...
@@ -457,6 +457,20 @@ func Convert_api_RoleList_To_v1_RoleList(in *authorizationapi.RoleList, out *aut
457 457
 	return autoConvert_api_RoleList_To_v1_RoleList(in, out, s)
458 458
 }
459 459
 
460
+func autoConvert_api_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview(in *authorizationapi.SelfSubjectRulesReview, out *authorizationapiv1.SelfSubjectRulesReview, s conversion.Scope) error {
461
+	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
462
+		defaulting.(func(*authorizationapi.SelfSubjectRulesReview))(in)
463
+	}
464
+	if err := Convert_api_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus(&in.Status, &out.Status, s); err != nil {
465
+		return err
466
+	}
467
+	return nil
468
+}
469
+
470
+func Convert_api_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview(in *authorizationapi.SelfSubjectRulesReview, out *authorizationapiv1.SelfSubjectRulesReview, s conversion.Scope) error {
471
+	return autoConvert_api_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview(in, out, s)
472
+}
473
+
460 474
 func autoConvert_api_SubjectAccessReview_To_v1_SubjectAccessReview(in *authorizationapi.SubjectAccessReview, out *authorizationapiv1.SubjectAccessReview, s conversion.Scope) error {
461 475
 	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
462 476
 		defaulting.(func(*authorizationapi.SubjectAccessReview))(in)
... ...
@@ -481,6 +495,28 @@ func Convert_api_SubjectAccessReviewResponse_To_v1_SubjectAccessReviewResponse(i
481 481
 	return autoConvert_api_SubjectAccessReviewResponse_To_v1_SubjectAccessReviewResponse(in, out, s)
482 482
 }
483 483
 
484
+func autoConvert_api_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus(in *authorizationapi.SubjectRulesReviewStatus, out *authorizationapiv1.SubjectRulesReviewStatus, s conversion.Scope) error {
485
+	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
486
+		defaulting.(func(*authorizationapi.SubjectRulesReviewStatus))(in)
487
+	}
488
+	if in.Rules != nil {
489
+		out.Rules = make([]authorizationapiv1.PolicyRule, len(in.Rules))
490
+		for i := range in.Rules {
491
+			if err := authorizationapiv1.Convert_api_PolicyRule_To_v1_PolicyRule(&in.Rules[i], &out.Rules[i], s); err != nil {
492
+				return err
493
+			}
494
+		}
495
+	} else {
496
+		out.Rules = nil
497
+	}
498
+	out.EvaluationError = in.EvaluationError
499
+	return nil
500
+}
501
+
502
+func Convert_api_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus(in *authorizationapi.SubjectRulesReviewStatus, out *authorizationapiv1.SubjectRulesReviewStatus, s conversion.Scope) error {
503
+	return autoConvert_api_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus(in, out, s)
504
+}
505
+
484 506
 func autoConvert_v1_ClusterPolicy_To_api_ClusterPolicy(in *authorizationapiv1.ClusterPolicy, out *authorizationapi.ClusterPolicy, s conversion.Scope) error {
485 507
 	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
486 508
 		defaulting.(func(*authorizationapiv1.ClusterPolicy))(in)
... ...
@@ -910,6 +946,20 @@ func Convert_v1_RoleList_To_api_RoleList(in *authorizationapiv1.RoleList, out *a
910 910
 	return autoConvert_v1_RoleList_To_api_RoleList(in, out, s)
911 911
 }
912 912
 
913
+func autoConvert_v1_SelfSubjectRulesReview_To_api_SelfSubjectRulesReview(in *authorizationapiv1.SelfSubjectRulesReview, out *authorizationapi.SelfSubjectRulesReview, s conversion.Scope) error {
914
+	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
915
+		defaulting.(func(*authorizationapiv1.SelfSubjectRulesReview))(in)
916
+	}
917
+	if err := Convert_v1_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus(&in.Status, &out.Status, s); err != nil {
918
+		return err
919
+	}
920
+	return nil
921
+}
922
+
923
+func Convert_v1_SelfSubjectRulesReview_To_api_SelfSubjectRulesReview(in *authorizationapiv1.SelfSubjectRulesReview, out *authorizationapi.SelfSubjectRulesReview, s conversion.Scope) error {
924
+	return autoConvert_v1_SelfSubjectRulesReview_To_api_SelfSubjectRulesReview(in, out, s)
925
+}
926
+
913 927
 func autoConvert_v1_SubjectAccessReview_To_api_SubjectAccessReview(in *authorizationapiv1.SubjectAccessReview, out *authorizationapi.SubjectAccessReview, s conversion.Scope) error {
914 928
 	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
915 929
 		defaulting.(func(*authorizationapiv1.SubjectAccessReview))(in)
... ...
@@ -934,6 +984,28 @@ func Convert_v1_SubjectAccessReviewResponse_To_api_SubjectAccessReviewResponse(i
934 934
 	return autoConvert_v1_SubjectAccessReviewResponse_To_api_SubjectAccessReviewResponse(in, out, s)
935 935
 }
936 936
 
937
+func autoConvert_v1_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus(in *authorizationapiv1.SubjectRulesReviewStatus, out *authorizationapi.SubjectRulesReviewStatus, s conversion.Scope) error {
938
+	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
939
+		defaulting.(func(*authorizationapiv1.SubjectRulesReviewStatus))(in)
940
+	}
941
+	if in.Rules != nil {
942
+		out.Rules = make([]authorizationapi.PolicyRule, len(in.Rules))
943
+		for i := range in.Rules {
944
+			if err := authorizationapiv1.Convert_v1_PolicyRule_To_api_PolicyRule(&in.Rules[i], &out.Rules[i], s); err != nil {
945
+				return err
946
+			}
947
+		}
948
+	} else {
949
+		out.Rules = nil
950
+	}
951
+	out.EvaluationError = in.EvaluationError
952
+	return nil
953
+}
954
+
955
+func Convert_v1_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus(in *authorizationapiv1.SubjectRulesReviewStatus, out *authorizationapi.SubjectRulesReviewStatus, s conversion.Scope) error {
956
+	return autoConvert_v1_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus(in, out, s)
957
+}
958
+
937 959
 func autoConvert_api_BinaryBuildRequestOptions_To_v1_BinaryBuildRequestOptions(in *buildapi.BinaryBuildRequestOptions, out *v1.BinaryBuildRequestOptions, s conversion.Scope) error {
938 960
 	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
939 961
 		defaulting.(func(*buildapi.BinaryBuildRequestOptions))(in)
... ...
@@ -9097,11 +9169,13 @@ func init() {
9097 9097
 		autoConvert_api_SecretSpec_To_v1_SecretSpec,
9098 9098
 		autoConvert_api_SecretVolumeSource_To_v1_SecretVolumeSource,
9099 9099
 		autoConvert_api_SecurityContext_To_v1_SecurityContext,
9100
+		autoConvert_api_SelfSubjectRulesReview_To_v1_SelfSubjectRulesReview,
9100 9101
 		autoConvert_api_SourceBuildStrategy_To_v1_SourceBuildStrategy,
9101 9102
 		autoConvert_api_SourceControlUser_To_v1_SourceControlUser,
9102 9103
 		autoConvert_api_SourceRevision_To_v1_SourceRevision,
9103 9104
 		autoConvert_api_SubjectAccessReviewResponse_To_v1_SubjectAccessReviewResponse,
9104 9105
 		autoConvert_api_SubjectAccessReview_To_v1_SubjectAccessReview,
9106
+		autoConvert_api_SubjectRulesReviewStatus_To_v1_SubjectRulesReviewStatus,
9105 9107
 		autoConvert_api_TCPSocketAction_To_v1_TCPSocketAction,
9106 9108
 		autoConvert_api_TLSConfig_To_v1_TLSConfig,
9107 9109
 		autoConvert_api_TagEventCondition_To_v1_TagEventCondition,
... ...
@@ -9277,11 +9351,13 @@ func init() {
9277 9277
 		autoConvert_v1_SecretSpec_To_api_SecretSpec,
9278 9278
 		autoConvert_v1_SecretVolumeSource_To_api_SecretVolumeSource,
9279 9279
 		autoConvert_v1_SecurityContext_To_api_SecurityContext,
9280
+		autoConvert_v1_SelfSubjectRulesReview_To_api_SelfSubjectRulesReview,
9280 9281
 		autoConvert_v1_SourceBuildStrategy_To_api_SourceBuildStrategy,
9281 9282
 		autoConvert_v1_SourceControlUser_To_api_SourceControlUser,
9282 9283
 		autoConvert_v1_SourceRevision_To_api_SourceRevision,
9283 9284
 		autoConvert_v1_SubjectAccessReviewResponse_To_api_SubjectAccessReviewResponse,
9284 9285
 		autoConvert_v1_SubjectAccessReview_To_api_SubjectAccessReview,
9286
+		autoConvert_v1_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus,
9285 9287
 		autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction,
9286 9288
 		autoConvert_v1_TLSConfig_To_api_TLSConfig,
9287 9289
 		autoConvert_v1_TagEventCondition_To_api_TagEventCondition,
... ...
@@ -656,6 +656,18 @@ func deepCopy_v1_RoleList(in v1.RoleList, out *v1.RoleList, c *conversion.Cloner
656 656
 	return nil
657 657
 }
658 658
 
659
+func deepCopy_v1_SelfSubjectRulesReview(in v1.SelfSubjectRulesReview, out *v1.SelfSubjectRulesReview, c *conversion.Cloner) error {
660
+	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
661
+		return err
662
+	} else {
663
+		out.TypeMeta = newVal.(unversioned.TypeMeta)
664
+	}
665
+	if err := deepCopy_v1_SubjectRulesReviewStatus(in.Status, &out.Status, c); err != nil {
666
+		return err
667
+	}
668
+	return nil
669
+}
670
+
659 671
 func deepCopy_v1_SubjectAccessReview(in v1.SubjectAccessReview, out *v1.SubjectAccessReview, c *conversion.Cloner) error {
660 672
 	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
661 673
 		return err
... ...
@@ -689,6 +701,21 @@ func deepCopy_v1_SubjectAccessReviewResponse(in v1.SubjectAccessReviewResponse,
689 689
 	return nil
690 690
 }
691 691
 
692
+func deepCopy_v1_SubjectRulesReviewStatus(in v1.SubjectRulesReviewStatus, out *v1.SubjectRulesReviewStatus, c *conversion.Cloner) error {
693
+	if in.Rules != nil {
694
+		out.Rules = make([]v1.PolicyRule, len(in.Rules))
695
+		for i := range in.Rules {
696
+			if err := deepCopy_v1_PolicyRule(in.Rules[i], &out.Rules[i], c); err != nil {
697
+				return err
698
+			}
699
+		}
700
+	} else {
701
+		out.Rules = nil
702
+	}
703
+	out.EvaluationError = in.EvaluationError
704
+	return nil
705
+}
706
+
692 707
 func deepCopy_v1_BinaryBuildRequestOptions(in apiv1.BinaryBuildRequestOptions, out *apiv1.BinaryBuildRequestOptions, c *conversion.Cloner) error {
693 708
 	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
694 709
 		return err
... ...
@@ -3205,8 +3232,10 @@ func init() {
3205 3205
 		deepCopy_v1_RoleBinding,
3206 3206
 		deepCopy_v1_RoleBindingList,
3207 3207
 		deepCopy_v1_RoleList,
3208
+		deepCopy_v1_SelfSubjectRulesReview,
3208 3209
 		deepCopy_v1_SubjectAccessReview,
3209 3210
 		deepCopy_v1_SubjectAccessReviewResponse,
3211
+		deepCopy_v1_SubjectRulesReviewStatus,
3210 3212
 		deepCopy_v1_BinaryBuildRequestOptions,
3211 3213
 		deepCopy_v1_BinaryBuildSource,
3212 3214
 		deepCopy_v1_Build,
... ...
@@ -460,6 +460,20 @@ func Convert_api_RoleList_To_v1beta3_RoleList(in *authorizationapi.RoleList, out
460 460
 	return autoConvert_api_RoleList_To_v1beta3_RoleList(in, out, s)
461 461
 }
462 462
 
463
+func autoConvert_api_SelfSubjectRulesReview_To_v1beta3_SelfSubjectRulesReview(in *authorizationapi.SelfSubjectRulesReview, out *authorizationapiv1beta3.SelfSubjectRulesReview, s conversion.Scope) error {
464
+	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
465
+		defaulting.(func(*authorizationapi.SelfSubjectRulesReview))(in)
466
+	}
467
+	if err := Convert_api_SubjectRulesReviewStatus_To_v1beta3_SubjectRulesReviewStatus(&in.Status, &out.Status, s); err != nil {
468
+		return err
469
+	}
470
+	return nil
471
+}
472
+
473
+func Convert_api_SelfSubjectRulesReview_To_v1beta3_SelfSubjectRulesReview(in *authorizationapi.SelfSubjectRulesReview, out *authorizationapiv1beta3.SelfSubjectRulesReview, s conversion.Scope) error {
474
+	return autoConvert_api_SelfSubjectRulesReview_To_v1beta3_SelfSubjectRulesReview(in, out, s)
475
+}
476
+
463 477
 func autoConvert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview(in *authorizationapi.SubjectAccessReview, out *authorizationapiv1beta3.SubjectAccessReview, s conversion.Scope) error {
464 478
 	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
465 479
 		defaulting.(func(*authorizationapi.SubjectAccessReview))(in)
... ...
@@ -484,6 +498,28 @@ func Convert_api_SubjectAccessReviewResponse_To_v1beta3_SubjectAccessReviewRespo
484 484
 	return autoConvert_api_SubjectAccessReviewResponse_To_v1beta3_SubjectAccessReviewResponse(in, out, s)
485 485
 }
486 486
 
487
+func autoConvert_api_SubjectRulesReviewStatus_To_v1beta3_SubjectRulesReviewStatus(in *authorizationapi.SubjectRulesReviewStatus, out *authorizationapiv1beta3.SubjectRulesReviewStatus, s conversion.Scope) error {
488
+	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
489
+		defaulting.(func(*authorizationapi.SubjectRulesReviewStatus))(in)
490
+	}
491
+	if in.Rules != nil {
492
+		out.Rules = make([]authorizationapiv1beta3.PolicyRule, len(in.Rules))
493
+		for i := range in.Rules {
494
+			if err := authorizationapiv1beta3.Convert_api_PolicyRule_To_v1beta3_PolicyRule(&in.Rules[i], &out.Rules[i], s); err != nil {
495
+				return err
496
+			}
497
+		}
498
+	} else {
499
+		out.Rules = nil
500
+	}
501
+	out.EvaluationError = in.EvaluationError
502
+	return nil
503
+}
504
+
505
+func Convert_api_SubjectRulesReviewStatus_To_v1beta3_SubjectRulesReviewStatus(in *authorizationapi.SubjectRulesReviewStatus, out *authorizationapiv1beta3.SubjectRulesReviewStatus, s conversion.Scope) error {
506
+	return autoConvert_api_SubjectRulesReviewStatus_To_v1beta3_SubjectRulesReviewStatus(in, out, s)
507
+}
508
+
487 509
 func autoConvert_v1beta3_ClusterPolicy_To_api_ClusterPolicy(in *authorizationapiv1beta3.ClusterPolicy, out *authorizationapi.ClusterPolicy, s conversion.Scope) error {
488 510
 	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
489 511
 		defaulting.(func(*authorizationapiv1beta3.ClusterPolicy))(in)
... ...
@@ -918,6 +954,20 @@ func Convert_v1beta3_RoleList_To_api_RoleList(in *authorizationapiv1beta3.RoleLi
918 918
 	return autoConvert_v1beta3_RoleList_To_api_RoleList(in, out, s)
919 919
 }
920 920
 
921
+func autoConvert_v1beta3_SelfSubjectRulesReview_To_api_SelfSubjectRulesReview(in *authorizationapiv1beta3.SelfSubjectRulesReview, out *authorizationapi.SelfSubjectRulesReview, s conversion.Scope) error {
922
+	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
923
+		defaulting.(func(*authorizationapiv1beta3.SelfSubjectRulesReview))(in)
924
+	}
925
+	if err := Convert_v1beta3_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus(&in.Status, &out.Status, s); err != nil {
926
+		return err
927
+	}
928
+	return nil
929
+}
930
+
931
+func Convert_v1beta3_SelfSubjectRulesReview_To_api_SelfSubjectRulesReview(in *authorizationapiv1beta3.SelfSubjectRulesReview, out *authorizationapi.SelfSubjectRulesReview, s conversion.Scope) error {
932
+	return autoConvert_v1beta3_SelfSubjectRulesReview_To_api_SelfSubjectRulesReview(in, out, s)
933
+}
934
+
921 935
 func autoConvert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview(in *authorizationapiv1beta3.SubjectAccessReview, out *authorizationapi.SubjectAccessReview, s conversion.Scope) error {
922 936
 	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
923 937
 		defaulting.(func(*authorizationapiv1beta3.SubjectAccessReview))(in)
... ...
@@ -942,6 +992,28 @@ func Convert_v1beta3_SubjectAccessReviewResponse_To_api_SubjectAccessReviewRespo
942 942
 	return autoConvert_v1beta3_SubjectAccessReviewResponse_To_api_SubjectAccessReviewResponse(in, out, s)
943 943
 }
944 944
 
945
+func autoConvert_v1beta3_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus(in *authorizationapiv1beta3.SubjectRulesReviewStatus, out *authorizationapi.SubjectRulesReviewStatus, s conversion.Scope) error {
946
+	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
947
+		defaulting.(func(*authorizationapiv1beta3.SubjectRulesReviewStatus))(in)
948
+	}
949
+	if in.Rules != nil {
950
+		out.Rules = make([]authorizationapi.PolicyRule, len(in.Rules))
951
+		for i := range in.Rules {
952
+			if err := authorizationapiv1beta3.Convert_v1beta3_PolicyRule_To_api_PolicyRule(&in.Rules[i], &out.Rules[i], s); err != nil {
953
+				return err
954
+			}
955
+		}
956
+	} else {
957
+		out.Rules = nil
958
+	}
959
+	out.EvaluationError = in.EvaluationError
960
+	return nil
961
+}
962
+
963
+func Convert_v1beta3_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus(in *authorizationapiv1beta3.SubjectRulesReviewStatus, out *authorizationapi.SubjectRulesReviewStatus, s conversion.Scope) error {
964
+	return autoConvert_v1beta3_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus(in, out, s)
965
+}
966
+
945 967
 func autoConvert_api_BinaryBuildRequestOptions_To_v1beta3_BinaryBuildRequestOptions(in *buildapi.BinaryBuildRequestOptions, out *v1beta3.BinaryBuildRequestOptions, s conversion.Scope) error {
946 968
 	if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
947 969
 		defaulting.(func(*buildapi.BinaryBuildRequestOptions))(in)
... ...
@@ -6880,11 +6952,13 @@ func init() {
6880 6880
 		autoConvert_api_SecretBuildSource_To_v1beta3_SecretBuildSource,
6881 6881
 		autoConvert_api_SecretSpec_To_v1beta3_SecretSpec,
6882 6882
 		autoConvert_api_SecretVolumeSource_To_v1beta3_SecretVolumeSource,
6883
+		autoConvert_api_SelfSubjectRulesReview_To_v1beta3_SelfSubjectRulesReview,
6883 6884
 		autoConvert_api_SourceBuildStrategy_To_v1beta3_SourceBuildStrategy,
6884 6885
 		autoConvert_api_SourceControlUser_To_v1beta3_SourceControlUser,
6885 6886
 		autoConvert_api_SourceRevision_To_v1beta3_SourceRevision,
6886 6887
 		autoConvert_api_SubjectAccessReviewResponse_To_v1beta3_SubjectAccessReviewResponse,
6887 6888
 		autoConvert_api_SubjectAccessReview_To_v1beta3_SubjectAccessReview,
6889
+		autoConvert_api_SubjectRulesReviewStatus_To_v1beta3_SubjectRulesReviewStatus,
6888 6890
 		autoConvert_api_TCPSocketAction_To_v1beta3_TCPSocketAction,
6889 6891
 		autoConvert_api_TLSConfig_To_v1beta3_TLSConfig,
6890 6892
 		autoConvert_api_TagImageHook_To_v1beta3_TagImageHook,
... ...
@@ -7023,11 +7097,13 @@ func init() {
7023 7023
 		autoConvert_v1beta3_SecretBuildSource_To_api_SecretBuildSource,
7024 7024
 		autoConvert_v1beta3_SecretSpec_To_api_SecretSpec,
7025 7025
 		autoConvert_v1beta3_SecretVolumeSource_To_api_SecretVolumeSource,
7026
+		autoConvert_v1beta3_SelfSubjectRulesReview_To_api_SelfSubjectRulesReview,
7026 7027
 		autoConvert_v1beta3_SourceBuildStrategy_To_api_SourceBuildStrategy,
7027 7028
 		autoConvert_v1beta3_SourceControlUser_To_api_SourceControlUser,
7028 7029
 		autoConvert_v1beta3_SourceRevision_To_api_SourceRevision,
7029 7030
 		autoConvert_v1beta3_SubjectAccessReviewResponse_To_api_SubjectAccessReviewResponse,
7030 7031
 		autoConvert_v1beta3_SubjectAccessReview_To_api_SubjectAccessReview,
7032
+		autoConvert_v1beta3_SubjectRulesReviewStatus_To_api_SubjectRulesReviewStatus,
7031 7033
 		autoConvert_v1beta3_TCPSocketAction_To_api_TCPSocketAction,
7032 7034
 		autoConvert_v1beta3_TLSConfig_To_api_TLSConfig,
7033 7035
 		autoConvert_v1beta3_TagImageHook_To_api_TagImageHook,
... ...
@@ -664,6 +664,18 @@ func deepCopy_v1beta3_RoleList(in v1beta3.RoleList, out *v1beta3.RoleList, c *co
664 664
 	return nil
665 665
 }
666 666
 
667
+func deepCopy_v1beta3_SelfSubjectRulesReview(in v1beta3.SelfSubjectRulesReview, out *v1beta3.SelfSubjectRulesReview, c *conversion.Cloner) error {
668
+	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
669
+		return err
670
+	} else {
671
+		out.TypeMeta = newVal.(unversioned.TypeMeta)
672
+	}
673
+	if err := deepCopy_v1beta3_SubjectRulesReviewStatus(in.Status, &out.Status, c); err != nil {
674
+		return err
675
+	}
676
+	return nil
677
+}
678
+
667 679
 func deepCopy_v1beta3_SubjectAccessReview(in v1beta3.SubjectAccessReview, out *v1beta3.SubjectAccessReview, c *conversion.Cloner) error {
668 680
 	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
669 681
 		return err
... ...
@@ -697,6 +709,21 @@ func deepCopy_v1beta3_SubjectAccessReviewResponse(in v1beta3.SubjectAccessReview
697 697
 	return nil
698 698
 }
699 699
 
700
+func deepCopy_v1beta3_SubjectRulesReviewStatus(in v1beta3.SubjectRulesReviewStatus, out *v1beta3.SubjectRulesReviewStatus, c *conversion.Cloner) error {
701
+	if in.Rules != nil {
702
+		out.Rules = make([]v1beta3.PolicyRule, len(in.Rules))
703
+		for i := range in.Rules {
704
+			if err := deepCopy_v1beta3_PolicyRule(in.Rules[i], &out.Rules[i], c); err != nil {
705
+				return err
706
+			}
707
+		}
708
+	} else {
709
+		out.Rules = nil
710
+	}
711
+	out.EvaluationError = in.EvaluationError
712
+	return nil
713
+}
714
+
700 715
 func deepCopy_v1beta3_BinaryBuildRequestOptions(in apiv1beta3.BinaryBuildRequestOptions, out *apiv1beta3.BinaryBuildRequestOptions, c *conversion.Cloner) error {
701 716
 	if newVal, err := c.DeepCopy(in.TypeMeta); err != nil {
702 717
 		return err
... ...
@@ -3008,8 +3035,10 @@ func init() {
3008 3008
 		deepCopy_v1beta3_RoleBinding,
3009 3009
 		deepCopy_v1beta3_RoleBindingList,
3010 3010
 		deepCopy_v1beta3_RoleList,
3011
+		deepCopy_v1beta3_SelfSubjectRulesReview,
3011 3012
 		deepCopy_v1beta3_SubjectAccessReview,
3012 3013
 		deepCopy_v1beta3_SubjectAccessReviewResponse,
3014
+		deepCopy_v1beta3_SubjectRulesReviewStatus,
3013 3015
 		deepCopy_v1beta3_BinaryBuildRequestOptions,
3014 3016
 		deepCopy_v1beta3_BinaryBuildSource,
3015 3017
 		deepCopy_v1beta3_Build,
... ...
@@ -36,6 +36,7 @@ func init() {
36 36
 }
37 37
 
38 38
 func registerAll() {
39
+	Validator.MustRegister(&authorizationapi.SelfSubjectRulesReview{}, authorizationvalidation.ValidateSelfSubjectRulesReview, nil)
39 40
 	Validator.MustRegister(&authorizationapi.SubjectAccessReview{}, authorizationvalidation.ValidateSubjectAccessReview, nil)
40 41
 	Validator.MustRegister(&authorizationapi.ResourceAccessReview{}, authorizationvalidation.ValidateResourceAccessReview, nil)
41 42
 	Validator.MustRegister(&authorizationapi.LocalSubjectAccessReview{}, authorizationvalidation.ValidateLocalSubjectAccessReview, nil)
... ...
@@ -37,6 +37,7 @@ func addKnownTypes(scheme *runtime.Scheme) {
37 37
 		&RoleBindingList{},
38 38
 		&RoleList{},
39 39
 
40
+		&SelfSubjectRulesReview{},
40 41
 		&ResourceAccessReview{},
41 42
 		&SubjectAccessReview{},
42 43
 		&LocalResourceAccessReview{},
... ...
@@ -72,6 +73,7 @@ func (obj *LocalSubjectAccessReview) GetObjectKind() unversioned.ObjectKind
72 72
 func (obj *LocalResourceAccessReview) GetObjectKind() unversioned.ObjectKind     { return &obj.TypeMeta }
73 73
 func (obj *SubjectAccessReview) GetObjectKind() unversioned.ObjectKind           { return &obj.TypeMeta }
74 74
 func (obj *ResourceAccessReview) GetObjectKind() unversioned.ObjectKind          { return &obj.TypeMeta }
75
+func (obj *SelfSubjectRulesReview) GetObjectKind() unversioned.ObjectKind        { return &obj.TypeMeta }
75 76
 
76 77
 func (obj *RoleList) GetObjectKind() unversioned.ObjectKind          { return &obj.TypeMeta }
77 78
 func (obj *RoleBindingList) GetObjectKind() unversioned.ObjectKind   { return &obj.TypeMeta }
... ...
@@ -92,7 +92,8 @@ var (
92 92
 		PermissionGrantingGroupName: {"roles", "rolebindings", "resourceaccessreviews" /* cluster scoped*/, "subjectaccessreviews" /* cluster scoped*/, "localresourceaccessreviews", "localsubjectaccessreviews"},
93 93
 		OpenshiftExposedGroupName:   {BuildGroupName, ImageGroupName, DeploymentGroupName, TemplateGroupName, "routes"},
94 94
 		OpenshiftAllGroupName: {OpenshiftExposedGroupName, UserGroupName, OAuthGroupName, PolicyOwnerGroupName, SDNGroupName, PermissionGrantingGroupName, OpenshiftStatusGroupName, "projects",
95
-			"clusterroles", "clusterrolebindings", "clusterpolicies", "clusterpolicybindings", "images" /* cluster scoped*/, "projectrequests", "builds/details", "imagestreams/secrets"},
95
+			"clusterroles", "clusterrolebindings", "clusterpolicies", "clusterpolicybindings", "images" /* cluster scoped*/, "projectrequests", "builds/details", "imagestreams/secrets",
96
+			"selfsubjectrulesreviews"},
96 97
 		OpenshiftStatusGroupName: {"imagestreams/status", "routes/status"},
97 98
 
98 99
 		QuotaGroupName:         {"limitranges", "resourcequotas", "resourcequotausages"},
... ...
@@ -199,6 +200,23 @@ type PolicyBinding struct {
199 199
 	RoleBindings map[string]*RoleBinding
200 200
 }
201 201
 
202
+// SelfSubjectRulesReview is a resource you can create to determine which actions you can perform in a namespace
203
+type SelfSubjectRulesReview struct {
204
+	unversioned.TypeMeta
205
+
206
+	// Status is completed by the server to tell which permissions you have
207
+	Status SubjectRulesReviewStatus
208
+}
209
+
210
+// SubjectRulesReviewStatus is contains the result of a rules check
211
+type SubjectRulesReviewStatus struct {
212
+	// Rules is the list of rules (no particular sort) that are allowed for the subject
213
+	Rules []PolicyRule
214
+	// EvaluationError can appear in combination with Rules.  It means some error happened during evaluation
215
+	// that may have prevented additional rules from being populated.
216
+	EvaluationError string
217
+}
218
+
202 219
 // ResourceAccessReviewResponse describes who can perform the action
203 220
 type ResourceAccessReviewResponse struct {
204 221
 	unversioned.TypeMeta
... ...
@@ -28,6 +28,7 @@ func addKnownTypes(scheme *runtime.Scheme) {
28 28
 		&RoleBindingList{},
29 29
 		&RoleList{},
30 30
 
31
+		&SelfSubjectRulesReview{},
31 32
 		&ResourceAccessReview{},
32 33
 		&SubjectAccessReview{},
33 34
 		&LocalResourceAccessReview{},
... ...
@@ -63,6 +64,7 @@ func (obj *LocalSubjectAccessReview) GetObjectKind() unversioned.ObjectKind
63 63
 func (obj *LocalResourceAccessReview) GetObjectKind() unversioned.ObjectKind     { return &obj.TypeMeta }
64 64
 func (obj *SubjectAccessReview) GetObjectKind() unversioned.ObjectKind           { return &obj.TypeMeta }
65 65
 func (obj *ResourceAccessReview) GetObjectKind() unversioned.ObjectKind          { return &obj.TypeMeta }
66
+func (obj *SelfSubjectRulesReview) GetObjectKind() unversioned.ObjectKind        { return &obj.TypeMeta }
66 67
 
67 68
 func (obj *RoleList) GetObjectKind() unversioned.ObjectKind          { return &obj.TypeMeta }
68 69
 func (obj *RoleBindingList) GetObjectKind() unversioned.ObjectKind   { return &obj.TypeMeta }
... ...
@@ -291,6 +291,15 @@ func (RoleList) SwaggerDoc() map[string]string {
291 291
 	return map_RoleList
292 292
 }
293 293
 
294
+var map_SelfSubjectRulesReview = map[string]string{
295
+	"":       "SelfSubjectRulesReview is a resource you can create to determine which actions you can perform in a namespace",
296
+	"status": "Status is completed by the server to tell which permissions you have",
297
+}
298
+
299
+func (SelfSubjectRulesReview) SwaggerDoc() map[string]string {
300
+	return map_SelfSubjectRulesReview
301
+}
302
+
294 303
 var map_SubjectAccessReview = map[string]string{
295 304
 	"":       "SubjectAccessReview is an object for requesting information about whether a user or group can perform an action",
296 305
 	"user":   "User is optional. If both User and Groups are empty, the current authenticated user is used.",
... ...
@@ -311,3 +320,13 @@ var map_SubjectAccessReviewResponse = map[string]string{
311 311
 func (SubjectAccessReviewResponse) SwaggerDoc() map[string]string {
312 312
 	return map_SubjectAccessReviewResponse
313 313
 }
314
+
315
+var map_SubjectRulesReviewStatus = map[string]string{
316
+	"":                "SubjectRulesReviewStatus is contains the result of a rules check",
317
+	"rules":           "Rules is the list of rules (no particular sort) that are allowed for the subject",
318
+	"evaluationError": "EvaluationError can appear in combination with Rules.  It means some error happened during evaluation that may have prevented additional rules from being populated.",
319
+}
320
+
321
+func (SubjectRulesReviewStatus) SwaggerDoc() map[string]string {
322
+	return map_SubjectRulesReviewStatus
323
+}
... ...
@@ -116,6 +116,23 @@ type NamedRoleBinding struct {
116 116
 	RoleBinding RoleBinding `json:"roleBinding"`
117 117
 }
118 118
 
119
+// SelfSubjectRulesReview is a resource you can create to determine which actions you can perform in a namespace
120
+type SelfSubjectRulesReview struct {
121
+	unversioned.TypeMeta `json:",inline"`
122
+
123
+	// Status is completed by the server to tell which permissions you have
124
+	Status SubjectRulesReviewStatus `json:"status,omitempty"`
125
+}
126
+
127
+// SubjectRulesReviewStatus is contains the result of a rules check
128
+type SubjectRulesReviewStatus struct {
129
+	// Rules is the list of rules (no particular sort) that are allowed for the subject
130
+	Rules []PolicyRule `json:"rules"`
131
+	// EvaluationError can appear in combination with Rules.  It means some error happened during evaluation
132
+	// that may have prevented additional rules from being populated.
133
+	EvaluationError string `json:"evaluationError,omitempty"`
134
+}
135
+
119 136
 // ResourceAccessReviewResponse describes who can perform the action
120 137
 type ResourceAccessReviewResponse struct {
121 138
 	unversioned.TypeMeta `json:",inline"`
... ...
@@ -28,6 +28,7 @@ func addKnownTypes(scheme *runtime.Scheme) {
28 28
 		&RoleBindingList{},
29 29
 		&RoleList{},
30 30
 
31
+		&SelfSubjectRulesReview{},
31 32
 		&ResourceAccessReview{},
32 33
 		&SubjectAccessReview{},
33 34
 		&LocalResourceAccessReview{},
... ...
@@ -63,6 +64,7 @@ func (obj *LocalSubjectAccessReview) GetObjectKind() unversioned.ObjectKind
63 63
 func (obj *LocalResourceAccessReview) GetObjectKind() unversioned.ObjectKind     { return &obj.TypeMeta }
64 64
 func (obj *SubjectAccessReview) GetObjectKind() unversioned.ObjectKind           { return &obj.TypeMeta }
65 65
 func (obj *ResourceAccessReview) GetObjectKind() unversioned.ObjectKind          { return &obj.TypeMeta }
66
+func (obj *SelfSubjectRulesReview) GetObjectKind() unversioned.ObjectKind        { return &obj.TypeMeta }
66 67
 
67 68
 func (obj *RoleList) GetObjectKind() unversioned.ObjectKind          { return &obj.TypeMeta }
68 69
 func (obj *RoleBindingList) GetObjectKind() unversioned.ObjectKind   { return &obj.TypeMeta }
... ...
@@ -109,6 +109,23 @@ type NamedRoleBinding struct {
109 109
 	RoleBinding RoleBinding `json:"roleBinding"`
110 110
 }
111 111
 
112
+// SelfSubjectRulesReview is a resource you can create to determine which actions you can perform in a namespace
113
+type SelfSubjectRulesReview struct {
114
+	unversioned.TypeMeta `json:",inline"`
115
+
116
+	// Status is completed by the server to tell which permissions you have
117
+	Status SubjectRulesReviewStatus `json:"status,omitempty"`
118
+}
119
+
120
+// SubjectRulesReviewStatus is contains the result of a rules check
121
+type SubjectRulesReviewStatus struct {
122
+	// Rules is the list of rules (no particular sort) that are allowed for the subject
123
+	Rules []PolicyRule `json:"rules"`
124
+	// EvaluationError can appear in combination with Rules.  It means some error happened during evaluation
125
+	// that may have prevented additional rules from being populated.
126
+	EvaluationError string `json:"evaluationError,omitempty"`
127
+}
128
+
112 129
 // ResourceAccessReviewResponse describes who can perform the action
113 130
 type ResourceAccessReviewResponse struct {
114 131
 	unversioned.TypeMeta `json:",inline"`
... ...
@@ -13,6 +13,10 @@ import (
13 13
 	uservalidation "github.com/openshift/origin/pkg/user/api/validation"
14 14
 )
15 15
 
16
+func ValidateSelfSubjectRulesReview(review *authorizationapi.SelfSubjectRulesReview) field.ErrorList {
17
+	return field.ErrorList{}
18
+}
19
+
16 20
 func ValidateSubjectAccessReview(review *authorizationapi.SubjectAccessReview) field.ErrorList {
17 21
 	allErrs := field.ErrorList{}
18 22
 
19 23
new file mode 100644
... ...
@@ -0,0 +1,39 @@
0
+package selfsubjectrulesreview
1
+
2
+import (
3
+	kapi "k8s.io/kubernetes/pkg/api"
4
+	"k8s.io/kubernetes/pkg/runtime"
5
+
6
+	authorizationapi "github.com/openshift/origin/pkg/authorization/api"
7
+	"github.com/openshift/origin/pkg/authorization/rulevalidation"
8
+)
9
+
10
+type REST struct {
11
+	ruleResolver rulevalidation.AuthorizationRuleResolver
12
+}
13
+
14
+func NewREST(ruleResolver rulevalidation.AuthorizationRuleResolver) *REST {
15
+	return &REST{ruleResolver: ruleResolver}
16
+}
17
+
18
+func (r *REST) New() runtime.Object {
19
+	return &authorizationapi.SelfSubjectRulesReview{}
20
+}
21
+
22
+// Create registers a given new ResourceAccessReview instance to r.registry.
23
+func (r *REST) Create(ctx kapi.Context, obj runtime.Object) (runtime.Object, error) {
24
+	// the input object has no valuable input, so don't bother checking it.false
25
+	policyRules, err := r.ruleResolver.GetEffectivePolicyRules(ctx)
26
+
27
+	ret := &authorizationapi.SelfSubjectRulesReview{
28
+		Status: authorizationapi.SubjectRulesReviewStatus{
29
+			Rules: policyRules,
30
+		},
31
+	}
32
+
33
+	if err != nil {
34
+		ret.Status.EvaluationError = err.Error()
35
+	}
36
+
37
+	return ret, nil
38
+}
... ...
@@ -44,6 +44,7 @@ type Interface interface {
44 44
 	ResourceAccessReviews
45 45
 	SubjectAccessReviews
46 46
 	LocalSubjectAccessReviewsNamespacer
47
+	SelfSubjectRulesReviewsNamespacer
47 48
 	TemplatesNamespacer
48 49
 	TemplateConfigsNamespacer
49 50
 	OAuthAccessTokensInterface
... ...
@@ -222,6 +223,10 @@ func (c *Client) SubjectAccessReviews() SubjectAccessReviewInterface {
222 222
 	return newSubjectAccessReviews(c)
223 223
 }
224 224
 
225
+func (c *Client) SelfSubjectRulesReviews(namespace string) SelfSubjectRulesReviewInterface {
226
+	return newSelfSubjectRulesReviews(c, namespace)
227
+}
228
+
225 229
 // OAuthAccessTokens provides a REST client for OAuthAccessTokens
226 230
 func (c *Client) OAuthAccessTokens() OAuthAccessTokenInterface {
227 231
 	return newOAuthAccessTokens(c)
228 232
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+package client
1
+
2
+import (
3
+	authorizationapi "github.com/openshift/origin/pkg/authorization/api"
4
+)
5
+
6
+type SelfSubjectRulesReviewsNamespacer interface {
7
+	SelfSubjectRulesReviews(namespace string) SelfSubjectRulesReviewInterface
8
+}
9
+
10
+type SelfSubjectRulesReviewInterface interface {
11
+	Create(*authorizationapi.SelfSubjectRulesReview) (*authorizationapi.SelfSubjectRulesReview, error)
12
+}
13
+
14
+type selfSubjectRulesReviews struct {
15
+	r  *Client
16
+	ns string
17
+}
18
+
19
+func newSelfSubjectRulesReviews(c *Client, namespace string) *selfSubjectRulesReviews {
20
+	return &selfSubjectRulesReviews{
21
+		r:  c,
22
+		ns: namespace,
23
+	}
24
+}
25
+
26
+func (c *selfSubjectRulesReviews) Create(selfSubjectRulesReview *authorizationapi.SelfSubjectRulesReview) (result *authorizationapi.SelfSubjectRulesReview, err error) {
27
+	result = &authorizationapi.SelfSubjectRulesReview{}
28
+	err = c.r.Post().Namespace(c.ns).Resource("selfSubjectRulesReviews").Body(selfSubjectRulesReview).Do().Into(result)
29
+
30
+	return
31
+}
... ...
@@ -256,6 +256,10 @@ func (c *Fake) PolicyBindings(namespace string) client.PolicyBindingInterface {
256 256
 	return &FakePolicyBindings{Fake: c, Namespace: namespace}
257 257
 }
258 258
 
259
+func (c *Fake) SelfSubjectRulesReviews(namespace string) client.SelfSubjectRulesReviewInterface {
260
+	return &FakeSelfSubjectRulesReviews{Fake: c, Namespace: namespace}
261
+}
262
+
259 263
 // LocalResourceAccessReviews provides a fake REST client for ResourceAccessReviews
260 264
 func (c *Fake) LocalResourceAccessReviews(namespace string) client.LocalResourceAccessReviewInterface {
261 265
 	return &FakeLocalResourceAccessReviews{Fake: c}
262 266
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+package testclient
1
+
2
+import (
3
+	ktestclient "k8s.io/kubernetes/pkg/client/unversioned/testclient"
4
+
5
+	authorizationapi "github.com/openshift/origin/pkg/authorization/api"
6
+)
7
+
8
+type FakeSelfSubjectRulesReviews struct {
9
+	Fake      *Fake
10
+	Namespace string
11
+}
12
+
13
+func (c *FakeSelfSubjectRulesReviews) Create(inObj *authorizationapi.SelfSubjectRulesReview) (*authorizationapi.SelfSubjectRulesReview, error) {
14
+	obj, err := c.Fake.Invokes(ktestclient.NewCreateAction("selfsubjectrulesreviews", c.Namespace, inObj), &authorizationapi.SelfSubjectRulesReview{})
15
+	if cast, ok := obj.(*authorizationapi.SelfSubjectRulesReview); ok {
16
+		return cast, err
17
+	}
18
+	return nil, err
19
+}
0 20
new file mode 100644
... ...
@@ -0,0 +1,90 @@
0
+package policy
1
+
2
+import (
3
+	"errors"
4
+	"fmt"
5
+	"io"
6
+	"text/tabwriter"
7
+
8
+	"github.com/spf13/cobra"
9
+
10
+	kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
11
+
12
+	authorizationapi "github.com/openshift/origin/pkg/authorization/api"
13
+	"github.com/openshift/origin/pkg/client"
14
+	"github.com/openshift/origin/pkg/cmd/cli/describe"
15
+	"github.com/openshift/origin/pkg/cmd/util/clientcmd"
16
+)
17
+
18
+const WhatCanIDoRecommendedName = "what-can-i-do"
19
+
20
+type whatCanIDoOptions struct {
21
+	namespace string
22
+	client    client.SelfSubjectRulesReviewsNamespacer
23
+
24
+	out io.Writer
25
+}
26
+
27
+// NewCmdWhatCanIDo implements the OpenShift cli who-can command
28
+func NewCmdWhatCanIDo(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
29
+	options := &whatCanIDoOptions{out: out}
30
+
31
+	cmd := &cobra.Command{
32
+		Use:   name,
33
+		Short: "List what I can do in this namespace",
34
+		Long:  "List what I can do in this namespace",
35
+		Run: func(cmd *cobra.Command, args []string) {
36
+			if err := options.complete(f, args); err != nil {
37
+				kcmdutil.CheckErr(kcmdutil.UsageError(cmd, err.Error()))
38
+			}
39
+
40
+			kcmdutil.CheckErr(options.run())
41
+		},
42
+	}
43
+
44
+	return cmd
45
+}
46
+
47
+const (
48
+	tabwriterMinWidth = 10
49
+	tabwriterWidth    = 4
50
+	tabwriterPadding  = 3
51
+	tabwriterPadChar  = ' '
52
+	tabwriterFlags    = 0
53
+)
54
+
55
+func (o *whatCanIDoOptions) complete(f *clientcmd.Factory, args []string) error {
56
+	if len(args) != 0 {
57
+		return errors.New("no arguments are supported")
58
+	}
59
+
60
+	var err error
61
+	o.client, _, err = f.Clients()
62
+	if err != nil {
63
+		return err
64
+	}
65
+
66
+	o.namespace, _, err = f.DefaultNamespace()
67
+	if err != nil {
68
+		return err
69
+	}
70
+
71
+	return nil
72
+}
73
+
74
+func (o *whatCanIDoOptions) run() error {
75
+	whatCanIDo, err := o.client.SelfSubjectRulesReviews(o.namespace).Create(&authorizationapi.SelfSubjectRulesReview{})
76
+	if err != nil {
77
+		return err
78
+	}
79
+
80
+	writer := tabwriter.NewWriter(o.out, tabwriterMinWidth, tabwriterWidth, tabwriterPadding, tabwriterPadChar, tabwriterFlags)
81
+	fmt.Fprint(writer, describe.PolicyRuleHeadings+"\n")
82
+	for _, rule := range whatCanIDo.Status.Rules {
83
+		describe.DescribePolicyRule(writer, rule, "")
84
+
85
+	}
86
+	writer.Flush()
87
+
88
+	return nil
89
+}
... ...
@@ -1101,9 +1101,9 @@ func DescribePolicy(policy *authorizationapi.Policy) (string, error) {
1101 1101
 		// using .List() here because I always want the sorted order that it provides
1102 1102
 		for _, key := range sets.StringKeySet(policy.Roles).List() {
1103 1103
 			role := policy.Roles[key]
1104
-			fmt.Fprint(out, key+"\t"+policyRuleHeadings+"\n")
1104
+			fmt.Fprint(out, key+"\t"+PolicyRuleHeadings+"\n")
1105 1105
 			for _, rule := range role.Rules {
1106
-				describePolicyRule(out, rule, "\t")
1106
+				DescribePolicyRule(out, rule, "\t")
1107 1107
 			}
1108 1108
 		}
1109 1109
 
... ...
@@ -1111,9 +1111,9 @@ func DescribePolicy(policy *authorizationapi.Policy) (string, error) {
1111 1111
 	})
1112 1112
 }
1113 1113
 
1114
-const policyRuleHeadings = "Verbs\tNon-Resource URLs\tExtension\tResource Names\tAPI Groups\tResources"
1114
+const PolicyRuleHeadings = "Verbs\tNon-Resource URLs\tExtension\tResource Names\tAPI Groups\tResources"
1115 1115
 
1116
-func describePolicyRule(out *tabwriter.Writer, rule authorizationapi.PolicyRule, indent string) {
1116
+func DescribePolicyRule(out *tabwriter.Writer, rule authorizationapi.PolicyRule, indent string) {
1117 1117
 	extensionString := ""
1118 1118
 	if rule.AttributeRestrictions != nil {
1119 1119
 		extensionString = fmt.Sprintf("%#v", rule.AttributeRestrictions)
... ...
@@ -1155,9 +1155,9 @@ func DescribeRole(role *authorizationapi.Role) (string, error) {
1155 1155
 	return tabbedString(func(out *tabwriter.Writer) error {
1156 1156
 		formatMeta(out, role.ObjectMeta)
1157 1157
 
1158
-		fmt.Fprint(out, policyRuleHeadings+"\n")
1158
+		fmt.Fprint(out, PolicyRuleHeadings+"\n")
1159 1159
 		for _, rule := range role.Rules {
1160
-			describePolicyRule(out, rule, "")
1160
+			DescribePolicyRule(out, rule, "")
1161 1161
 
1162 1162
 		}
1163 1163
 
... ...
@@ -1248,9 +1248,9 @@ func DescribeRoleBinding(roleBinding *authorizationapi.RoleBinding, role *author
1248 1248
 			formatString(out, "Policy Rules", fmt.Sprintf("error: %v", err))
1249 1249
 
1250 1250
 		case role != nil:
1251
-			fmt.Fprint(out, policyRuleHeadings+"\n")
1251
+			fmt.Fprint(out, PolicyRuleHeadings+"\n")
1252 1252
 			for _, rule := range role.Rules {
1253
-				describePolicyRule(out, rule, "")
1253
+				DescribePolicyRule(out, rule, "")
1254 1254
 			}
1255 1255
 
1256 1256
 		default:
... ...
@@ -67,6 +67,7 @@ var DescriberCoverageExceptions = []reflect.Type{
67 67
 	reflect.TypeOf(&authorizationapi.ResourceAccessReview{}),
68 68
 	reflect.TypeOf(&authorizationapi.LocalSubjectAccessReview{}),
69 69
 	reflect.TypeOf(&authorizationapi.LocalResourceAccessReview{}),
70
+	reflect.TypeOf(&authorizationapi.SelfSubjectRulesReview{}),
70 71
 }
71 72
 
72 73
 // MissingDescriberCoverageExceptions is the list of types that were missing describer methods when I started
... ...
@@ -39,6 +39,7 @@ var PrinterCoverageExceptions = []reflect.Type{
39 39
 	reflect.TypeOf(&authorizationapi.ResourceAccessReview{}),
40 40
 	reflect.TypeOf(&authorizationapi.LocalSubjectAccessReview{}),
41 41
 	reflect.TypeOf(&authorizationapi.LocalResourceAccessReview{}),
42
+	reflect.TypeOf(&authorizationapi.SelfSubjectRulesReview{}),
42 43
 	reflect.TypeOf(&buildapi.BuildLog{}),
43 44
 	reflect.TypeOf(&buildapi.BinaryBuildRequestOptions{}),
44 45
 	reflect.TypeOf(&buildapi.BuildRequest{}),
... ...
@@ -22,6 +22,7 @@ func NewCmdPolicy(name, fullName string, f *clientcmd.Factory, out io.Writer) *c
22 22
 	}
23 23
 
24 24
 	cmds.AddCommand(adminpolicy.NewCmdWhoCan(adminpolicy.WhoCanRecommendedName, fullName+" "+adminpolicy.WhoCanRecommendedName, f, out))
25
+	cmds.AddCommand(adminpolicy.NewCmdWhatCanIDo(adminpolicy.WhatCanIDoRecommendedName, fullName+" "+adminpolicy.WhatCanIDoRecommendedName, f, out))
25 26
 
26 27
 	cmds.AddCommand(adminpolicy.NewCmdAddRoleToUser(adminpolicy.AddRoleToUserRecommendedName, fullName+" "+adminpolicy.AddRoleToUserRecommendedName, f, out))
27 28
 	cmds.AddCommand(adminpolicy.NewCmdRemoveRoleFromUser(adminpolicy.RemoveRoleFromUserRecommendedName, fullName+" "+adminpolicy.RemoveRoleFromUserRecommendedName, f, out))
... ...
@@ -336,6 +336,7 @@ func GetBootstrapClusterRoles() []authorizationapi.ClusterRole {
336 336
 				{Verbs: sets.NewString("list", "get"), Resources: sets.NewString("clusterroles")},
337 337
 				{Verbs: sets.NewString("list", "watch"), Resources: sets.NewString("projects")},
338 338
 				{Verbs: sets.NewString("create"), Resources: sets.NewString("subjectaccessreviews", "localsubjectaccessreviews"), AttributeRestrictions: &authorizationapi.IsPersonalSubjectAccessReview{}},
339
+				{Verbs: sets.NewString("create"), Resources: sets.NewString("selfsubjectrulesreviews")},
339 340
 			},
340 341
 		},
341 342
 		{
... ...
@@ -101,6 +101,7 @@ import (
101 101
 	"github.com/openshift/origin/pkg/authorization/registry/resourceaccessreview"
102 102
 	rolestorage "github.com/openshift/origin/pkg/authorization/registry/role/policybased"
103 103
 	rolebindingstorage "github.com/openshift/origin/pkg/authorization/registry/rolebinding/policybased"
104
+	"github.com/openshift/origin/pkg/authorization/registry/selfsubjectrulesreview"
104 105
 	"github.com/openshift/origin/pkg/authorization/registry/subjectaccessreview"
105 106
 	"github.com/openshift/origin/pkg/authorization/rulevalidation"
106 107
 	configapi "github.com/openshift/origin/pkg/cmd/server/api"
... ...
@@ -389,6 +390,8 @@ func (c *MasterConfig) GetRestStorage() map[string]rest.Storage {
389 389
 	identityRegistry := identityregistry.NewRegistry(identityStorage)
390 390
 	userIdentityMappingStorage := useridentitymapping.NewREST(userRegistry, identityRegistry)
391 391
 
392
+	selfSubjectRulesReviewStorage := selfsubjectrulesreview.NewREST(c.RuleResolver)
393
+
392 394
 	policyStorage := policyetcd.NewStorage(c.EtcdHelper)
393 395
 	policyRegistry := policyregistry.NewRegistry(policyStorage)
394 396
 	policyBindingStorage := policybindingetcd.NewStorage(c.EtcdHelper)
... ...
@@ -528,6 +531,7 @@ func (c *MasterConfig) GetRestStorage() map[string]rest.Storage {
528 528
 		"subjectAccessReviews":       subjectAccessReviewStorage,
529 529
 		"localSubjectAccessReviews":  localSubjectAccessReviewStorage,
530 530
 		"localResourceAccessReviews": localResourceAccessReviewStorage,
531
+		"selfSubjectRulesReviews":    selfSubjectRulesReviewStorage,
531 532
 
532 533
 		"policies":       policyStorage,
533 534
 		"policyBindings": policyBindingStorage,
... ...
@@ -73,6 +73,7 @@ import (
73 73
 type MasterConfig struct {
74 74
 	Options configapi.MasterConfig
75 75
 
76
+	RuleResolver                  rulevalidation.AuthorizationRuleResolver
76 77
 	Authenticator                 authenticator.Request
77 78
 	Authorizer                    authorizer.Authorizer
78 79
 	AuthorizationAttributeBuilder authorizer.AuthorizationAttributeBuilder
... ...
@@ -177,7 +178,13 @@ func BuildMasterConfig(options configapi.MasterConfig) (*MasterConfig, error) {
177 177
 		admissionControlPluginNames = options.AdmissionConfig.PluginOrderOverride
178 178
 	}
179 179
 
180
-	authorizer := newAuthorizer(policyClient, options.ProjectConfig.ProjectRequestMessage)
180
+	ruleResolver := rulevalidation.NewDefaultRuleResolver(
181
+		rulevalidation.PolicyGetter(policyClient),
182
+		rulevalidation.BindingLister(policyClient),
183
+		rulevalidation.ClusterPolicyGetter(policyClient),
184
+		rulevalidation.ClusterBindingLister(policyClient),
185
+	)
186
+	authorizer := newAuthorizer(ruleResolver, options.ProjectConfig.ProjectRequestMessage)
181 187
 
182 188
 	pluginInitializer := oadmission.PluginInitializer{
183 189
 		OpenshiftClient: privilegedLoopbackOpenShiftClient,
... ...
@@ -214,6 +221,7 @@ func BuildMasterConfig(options configapi.MasterConfig) (*MasterConfig, error) {
214 214
 	config := &MasterConfig{
215 215
 		Options: options,
216 216
 
217
+		RuleResolver:                  ruleResolver,
217 218
 		Authenticator:                 newAuthenticator(options, etcdHelper, serviceAccountTokenGetter, apiClientCAs, groupCache),
218 219
 		Authorizer:                    authorizer,
219 220
 		AuthorizationAttributeBuilder: newAuthorizationAttributeBuilder(requestContextMapper),
... ...
@@ -363,13 +371,8 @@ func newReadOnlyCacheAndClient(etcdHelper storage.Interface) (cache policycache.
363 363
 	return
364 364
 }
365 365
 
366
-func newAuthorizer(policyClient policyclient.ReadOnlyPolicyClient, projectRequestDenyMessage string) authorizer.Authorizer {
367
-	authorizer := authorizer.NewAuthorizer(rulevalidation.NewDefaultRuleResolver(
368
-		rulevalidation.PolicyGetter(policyClient),
369
-		rulevalidation.BindingLister(policyClient),
370
-		rulevalidation.ClusterPolicyGetter(policyClient),
371
-		rulevalidation.ClusterBindingLister(policyClient),
372
-	), authorizer.NewForbiddenMessageResolver(projectRequestDenyMessage))
366
+func newAuthorizer(ruleResolver rulevalidation.AuthorizationRuleResolver, projectRequestDenyMessage string) authorizer.Authorizer {
367
+	authorizer := authorizer.NewAuthorizer(ruleResolver, authorizer.NewForbiddenMessageResolver(projectRequestDenyMessage))
373 368
 	return authorizer
374 369
 }
375 370
 
... ...
@@ -81,6 +81,9 @@ os::cmd::expect_success_and_not_text 'oadm policy who-can create builds/jenkinsp
81 81
 os::cmd::expect_success 'oadm policy reconcile-cluster-role-bindings --confirm'
82 82
 
83 83
 
84
+os::cmd::expect_success_and_text 'oc policy what-can-i-do' 'get update.*imagestreams/layers'
85
+
86
+
84 87
 # adjust the cluster-admin role to check defaulting and coverage checks
85 88
 # this is done here instead of an integration test because we need to make sure the actual yaml serializations work
86 89
 workingdir=$(mktemp -d)
... ...
@@ -105,6 +105,7 @@ items:
105 105
     - routes
106 106
     - routes/status
107 107
     - securitycontextconstraints
108
+    - selfsubjectrulesreviews
108 109
     - serviceaccounts
109 110
     - services
110 111
     - subjectaccessreviews
... ...
@@ -712,6 +713,12 @@ items:
712 712
     - subjectaccessreviews
713 713
     verbs:
714 714
     - create
715
+  - apiGroups: null
716
+    attributeRestrictions: null
717
+    resources:
718
+    - selfsubjectrulesreviews
719
+    verbs:
720
+    - create
715 721
 - apiVersion: v1
716 722
   kind: ClusterRole
717 723
   metadata: