fixed doc env vars + mongo v2 migration
This commit is contained in:
@@ -3,7 +3,7 @@ package model
|
||||
import (
|
||||
"github.com/tech/sendico/pkg/db/storable"
|
||||
"github.com/tech/sendico/pkg/mservice"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// Action represents a permissible action on a resource.
|
||||
@@ -29,7 +29,7 @@ const (
|
||||
type RoleDescription struct {
|
||||
storable.Base `bson:",inline" json:",inline"` // Base fields for MongoDB documents
|
||||
Describable `bson:",inline" json:",inline"` // Name and description fields
|
||||
OrganizationRef primitive.ObjectID `bson:"organizationRef" json:"organizationRef"` // Organization associated with the role
|
||||
OrganizationRef bson.ObjectID `bson:"organizationRef" json:"organizationRef"` // Organization associated with the role
|
||||
}
|
||||
|
||||
// Collection specifies the MongoDB collection for RoleDescription.
|
||||
@@ -39,9 +39,9 @@ func (*RoleDescription) Collection() string {
|
||||
|
||||
// Role represents a role assignment for an account within an organization.
|
||||
type Role struct {
|
||||
AccountRef primitive.ObjectID `bson:"accountRef" json:"accountRef"` // Account assigned to the role
|
||||
DescriptionRef primitive.ObjectID `bson:"descriptionRef" json:"descriptionRef"` // Reference to the role's description
|
||||
OrganizationRef primitive.ObjectID `bson:"organizationRef" json:"organizationRef"` // Organization where the role is applicable
|
||||
AccountRef bson.ObjectID `bson:"accountRef" json:"accountRef"` // Account assigned to the role
|
||||
DescriptionRef bson.ObjectID `bson:"descriptionRef" json:"descriptionRef"` // Reference to the role's description
|
||||
OrganizationRef bson.ObjectID `bson:"organizationRef" json:"organizationRef"` // Organization where the role is applicable
|
||||
}
|
||||
|
||||
// ActionEffect represents a combination of an action and its effect (allow/deny).
|
||||
@@ -52,16 +52,16 @@ type ActionEffect struct {
|
||||
|
||||
// Policy defines access control rules for a role within an organization.
|
||||
type Policy struct {
|
||||
OrganizationRef primitive.ObjectID `bson:"organizationRef" json:"organizationRef"` // Organization associated with the policy
|
||||
DescriptionRef primitive.ObjectID `bson:"descriptionRef" json:"descriptionRef"` // Reference to the policy's metadata
|
||||
ObjectRef *primitive.ObjectID `bson:"objectRef,omitempty" json:"objectRef,omitempty"` // Target object (NilObjectID for all objects)
|
||||
Effect ActionEffect `bson:"effect" json:"effect"` // Action and effect for the policy
|
||||
OrganizationRef bson.ObjectID `bson:"organizationRef" json:"organizationRef"` // Organization associated with the policy
|
||||
DescriptionRef bson.ObjectID `bson:"descriptionRef" json:"descriptionRef"` // Reference to the policy's metadata
|
||||
ObjectRef *bson.ObjectID `bson:"objectRef,omitempty" json:"objectRef,omitempty"` // Target object (NilObjectID for all objects)
|
||||
Effect ActionEffect `bson:"effect" json:"effect"` // Action and effect for the policy
|
||||
}
|
||||
|
||||
// RolePolicy defines access control rules for a role within an organization.
|
||||
type RolePolicy struct {
|
||||
Policy `bson:",inline" json:",inline"`
|
||||
RoleDescriptionRef primitive.ObjectID `bson:"roleDescriptionRef" json:"roleDescriptionRef"` // Reference to the associated role
|
||||
RoleDescriptionRef bson.ObjectID `bson:"roleDescriptionRef" json:"roleDescriptionRef"` // Reference to the associated role
|
||||
}
|
||||
|
||||
// PolicyDescription provides metadata for policies.
|
||||
@@ -69,7 +69,7 @@ type PolicyDescription struct {
|
||||
storable.Base `bson:",inline" json:",inline"` // Base fields for MongoDB documents
|
||||
Describable `bson:",inline" json:",inline"` // Name and description fields
|
||||
ResourceTypes *[]mservice.Type `bson:"resourceTypes,omitempty" json:"resourceTypes,omitempty"` // nil for custom policies, non-nil for built-in permissisons
|
||||
OrganizationRef *primitive.ObjectID `bson:"organizationRef,omitempty" json:"organizationRef,omitempty"` // nil for built-in policies, non-nil for custom
|
||||
OrganizationRef *bson.ObjectID `bson:"organizationRef,omitempty" json:"organizationRef,omitempty"` // nil for built-in policies, non-nil for custom
|
||||
}
|
||||
|
||||
// Collection specifies the MongoDB collection for PolicyDescription.
|
||||
@@ -80,5 +80,5 @@ func (*PolicyDescription) Collection() string {
|
||||
// Permission ties a policy to a specific account.
|
||||
type Permission struct {
|
||||
RolePolicy `bson:",inline" json:",inline"` // Embedded policy definition
|
||||
AccountRef primitive.ObjectID `bson:"accountRef" json:"accountRef"` // Account assigned the permission
|
||||
AccountRef bson.ObjectID `bson:"accountRef" json:"accountRef"` // Account assigned the permission
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user