feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
84
pkg/componenthelper/auth/rbac/workspacerole_interfaces.go
Normal file
84
pkg/componenthelper/auth/rbac/workspacerole_interfaces.go
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Please refer to the LICENSE file in the root directory of the project.
|
||||
* https://github.com/kubesphere/kubesphere/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package rbac
|
||||
|
||||
import (
|
||||
rbacv1 "k8s.io/api/rbac/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
iamv1beta1 "kubesphere.io/api/iam/v1beta1"
|
||||
)
|
||||
|
||||
type WorkspaceRoleRuleOwner struct {
|
||||
WorkspaceRole *iamv1beta1.WorkspaceRole
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetRuleOwnerScope() string {
|
||||
return iamv1beta1.ScopeWorkspace
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetObject() runtime.Object {
|
||||
return w.WorkspaceRole
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetNamespace() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetName() string {
|
||||
return w.WorkspaceRole.Name
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetLabels() map[string]string {
|
||||
return w.WorkspaceRole.Labels
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) SetLabels(m map[string]string) {
|
||||
w.WorkspaceRole.Labels = m
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetAnnotations() map[string]string {
|
||||
return w.WorkspaceRole.Annotations
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) SetAnnotations(m map[string]string) {
|
||||
w.WorkspaceRole.Annotations = m
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetRules() []rbacv1.PolicyRule {
|
||||
return w.WorkspaceRole.Rules
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) SetRules(rules []rbacv1.PolicyRule) {
|
||||
w.WorkspaceRole.Rules = rules
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetAggregationRule() *iamv1beta1.AggregationRoleTemplates {
|
||||
return w.WorkspaceRole.AggregationRoleTemplates
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) SetAggregationRule(i *iamv1beta1.AggregationRoleTemplates) {
|
||||
w.WorkspaceRole.AggregationRoleTemplates = i
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) GetRegoPolicy() string {
|
||||
if w.WorkspaceRole.ObjectMeta.Annotations != nil {
|
||||
return w.WorkspaceRole.ObjectMeta.Annotations[iamv1beta1.RegoOverrideAnnotation]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) SetRegoPolicy(rego string) {
|
||||
if w.WorkspaceRole.ObjectMeta.Annotations == nil {
|
||||
w.WorkspaceRole.ObjectMeta.Annotations = make(map[string]string)
|
||||
}
|
||||
w.WorkspaceRole.ObjectMeta.Annotations[iamv1beta1.RegoOverrideAnnotation] = rego
|
||||
}
|
||||
|
||||
func (w WorkspaceRoleRuleOwner) DeepCopyRuleOwner() RuleOwner {
|
||||
return WorkspaceRoleRuleOwner{WorkspaceRole: w.WorkspaceRole.DeepCopy()}
|
||||
}
|
||||
|
||||
var _ RuleOwner = WorkspaceRoleRuleOwner{}
|
||||
Reference in New Issue
Block a user