Documentation ¶
Overview ¶
Package user package is to manage the context of user information
Package user package is to manage the context of user information ¶
Package user package is to manage the context of user information
Index ¶
- func EntityFromContext(ctx context.Context) *unstructured.Unstructured
- func GetBaseUserInfoFromReq(req *restful.Request) *metav1alpha1.GitUserBaseInfo
- func UserInfoFilter(req *restful.Request, res *restful.Response, chain *restful.FilterChain)
- func UserInfoFrom(ctx context.Context) (metav1alpha1.UserInfo, bool)
- func UserInfoValue(ctx context.Context) (result metav1alpha1.UserInfo)
- func UserOwnedResourcePermissionFilter(appCtx context.Context, groupVersionResource *schema.GroupVersionResource) restful.FilterFunction
- func WithEntity(ctx context.Context, entity *unstructured.Unstructured) context.Context
- func WithUserInfo(parent context.Context, userinfo metav1alpha1.UserInfo) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EntityFromContext ¶ added in v0.8.0
func EntityFromContext(ctx context.Context) *unstructured.Unstructured
EntityFromContext will read entity from context up to now, we will use it to save operation target object in UserOwnedResouorceFilter and you could use EntityFromContext to avoid reading and unmarshall data from request again
func GetBaseUserInfoFromReq ¶
func GetBaseUserInfoFromReq(req *restful.Request) *metav1alpha1.GitUserBaseInfo
GetBaseUserInfoFromReq get the base userinfo from the request object
func UserInfoFilter ¶
UserInfoFilter is to parse the user login information from the request header into userinfo, and store it in the context
func UserInfoFrom ¶
func UserInfoFrom(ctx context.Context) (metav1alpha1.UserInfo, bool)
UserInfoFrom returns the value of the userinfo key on the ctx
func UserInfoValue ¶
func UserInfoValue(ctx context.Context) (result metav1alpha1.UserInfo)
UserInfoValue returns the value of the userinfo key on the ctx, or the empty string if none
func UserOwnedResourcePermissionFilter ¶ added in v0.8.0
func UserOwnedResourcePermissionFilter(appCtx context.Context, groupVersionResource *schema.GroupVersionResource) restful.FilterFunction
UserOwnedResourcePermissionFilter provides a mechanism to check permissions for user owned resource the user owned resource could use annotation to annotated owner name and the filter will check if current user could execcute the `verb` for the resource more doc about it please see Spec: user owned resource permission check
func WithEntity ¶ added in v0.8.0
func WithEntity(ctx context.Context, entity *unstructured.Unstructured) context.Context
WithEntity will save entity into context up to now, we will use it to save operation target object in UserOwnedResouorceFilter and you could use EntityFromContext to avoid reading and unmarshall data from request again
func WithUserInfo ¶
WithUserInfo returns a copy of parent in which the userinfo value is set
Types ¶
This section is empty.