Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 23 for withUser (0.2 sec)

  1. pkg/registry/admissionregistration/validatingadmissionpolicy/authz_test.go

    			t.Run("create", func(t *testing.T) {
    				ctx := request.WithUser(context.Background(), tc.userInfo)
    				errs := strategy.Validate(ctx, validValidatingAdmissionPolicy())
    				if len(errs) > 0 != tc.expectErr {
    					t.Errorf("expected error: %v but got error: %v", tc.expectErr, errs)
    				}
    			})
    			t.Run("update", func(t *testing.T) {
    				ctx := request.WithUser(context.Background(), tc.userInfo)
    				obj := validValidatingAdmissionPolicy()
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Nov 07 21:29:56 UTC 2022
    - 3.8K bytes
    - Viewed (0)
  2. plugin/pkg/admission/eventratelimit/admission_test.go

    			requests: []request{
    				newEventRequest().withUser("A"),
    				newEventRequest().withUser("A"),
    				newEventRequest().withUser("A"),
    				newEventRequest().withUser("A").blocked(),
    			},
    		},
    		{
    			name: "event from other user not blocked",
    			requests: []request{
    				newEventRequest().withUser("A"),
    				newEventRequest().withUser("A"),
    				newEventRequest().withUser("A"),
    				newEventRequest().withUser("B"),
    			},
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Sep 17 13:19:08 UTC 2021
    - 15.6K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/endpoints/request/context.go

    func NamespaceValue(ctx context.Context) string {
    	namespace, _ := NamespaceFrom(ctx)
    	return namespace
    }
    
    // WithUser returns a copy of parent in which the user value is set
    func WithUser(parent context.Context, user user.Info) context.Context {
    	return WithValue(parent, userKey, user)
    }
    
    // UserFrom returns the value of the user key on the ctx
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Sep 23 14:08:44 UTC 2021
    - 2.4K bytes
    - Viewed (0)
  4. staging/src/k8s.io/client-go/applyconfigurations/core/v1/quobytevolumesource.go

    	b.ReadOnly = &value
    	return b
    }
    
    // WithUser sets the User field in the declarative configuration to the given value
    // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    // If called multiple times, the User field is set to the value of the last call.
    func (b *QuobyteVolumeSourceApplyConfiguration) WithUser(value string) *QuobyteVolumeSourceApplyConfiguration {
    	b.User = &value
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 04 18:31:34 UTC 2021
    - 3.8K bytes
    - Viewed (0)
  5. staging/src/k8s.io/client-go/applyconfigurations/core/v1/cephfspersistentvolumesource.go

    	b.Path = &value
    	return b
    }
    
    // WithUser sets the User field in the declarative configuration to the given value
    // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    // If called multiple times, the User field is set to the value of the last call.
    func (b *CephFSPersistentVolumeSourceApplyConfiguration) WithUser(value string) *CephFSPersistentVolumeSourceApplyConfiguration {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 04 18:31:34 UTC 2021
    - 4.2K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/endpoints/request/context_test.go

    func TestUserContext(t *testing.T) {
    	ctx := NewContext()
    	_, ok := UserFrom(ctx)
    	if ok {
    		t.Fatalf("Should not be ok because there is no user.Info on the context")
    	}
    	ctx = WithUser(
    		ctx,
    		&user.DefaultInfo{
    			Name:   "bob",
    			UID:    "123",
    			Groups: []string{"group1"},
    			Extra:  map[string][]string{"foo": {"bar"}},
    		},
    	)
    
    	result, ok := UserFrom(ctx)
    	if !ok {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jul 26 17:14:05 UTC 2022
    - 2.7K bytes
    - Viewed (0)
  7. pkg/registry/admissionregistration/validatingadmissionpolicybinding/authz_test.go

    				ctx := request.WithUser(context.Background(), tc.userInfo)
    				for _, obj := range validPolicyBindings() {
    					errs := strategy.Validate(ctx, obj)
    					if len(errs) > 0 != tc.expectErr {
    						t.Errorf("expected error: %v but got error: %v", tc.expectErr, errs)
    					}
    				}
    			})
    			t.Run("update", func(t *testing.T) {
    				ctx := request.WithUser(context.Background(), tc.userInfo)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Jul 20 16:30:09 UTC 2023
    - 5.7K bytes
    - Viewed (0)
  8. staging/src/k8s.io/client-go/applyconfigurations/core/v1/cephfsvolumesource.go

    	b.Path = &value
    	return b
    }
    
    // WithUser sets the User field in the declarative configuration to the given value
    // and returns the receiver, so that objects can be built by chaining "With" function invocations.
    // If called multiple times, the User field is set to the value of the last call.
    func (b *CephFSVolumeSourceApplyConfiguration) WithUser(value string) *CephFSVolumeSourceApplyConfiguration {
    	b.User = &value
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 04 18:31:34 UTC 2021
    - 4.1K bytes
    - Viewed (0)
  9. pkg/registry/rbac/clusterrole/policybased/storage_test.go

    			expectAllowed: true,
    		},
    	}
    
    	for _, tc := range testcases {
    		t.Run(tc.name, func(t *testing.T) {
    			authzCalled, fakeStorage.created, fakeStorage.updated = 0, 0, 0
    			_, err := s.Create(request.WithUser(createContext, tc.user), role, nil, nil)
    
    			if tc.expectAllowed {
    				if err != nil {
    					t.Error(err)
    					return
    				}
    				if fakeStorage.created != 1 {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Apr 09 13:47:19 UTC 2021
    - 6.2K bytes
    - Viewed (0)
  10. pkg/registry/certificates/certificates/strategy_test.go

    				Status: certapi.CertificateSigningRequestStatus{Conditions: []certapi.CertificateSigningRequestCondition{}},
    			},
    		},
    		"user in context, no user in obj": {
    			ctx: genericapirequest.WithUser(
    				genericapirequest.NewContext(),
    				&user.DefaultInfo{
    					Name:   "bob",
    					UID:    "123",
    					Groups: []string{"group1"},
    					Extra:  map[string][]string{"foo": {"bar"}},
    				},
    			),
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 15 14:34:53 UTC 2024
    - 7.6K bytes
    - Viewed (0)
Back to top