Exemple #1
0
class NodeUser(models.Model):
    name = models.CharField(help_text="User name of node",
                            max_length=64,
                            default="")
    secret = models.CharField(help_text="User secret of node",
                              max_length=64,
                              default="")
    user_type = models.CharField(
        help_text="User type of node",
        choices=FabricCAUserType.to_choices(),
        default=FabricCAUserType.Peer.value,
        max_length=64,
    )
    node = models.ForeignKey(Node,
                             help_text="Node of user",
                             on_delete=models.CASCADE,
                             null=True)
    status = models.CharField(
        help_text="Status of node user",
        choices=FabricCAUserStatus.to_choices(),
        default=FabricCAUserStatus.Registering.value,
        max_length=32,
    )
    attrs = models.CharField(help_text="Attributes of node user",
                             default="",
                             max_length=512)

    class Meta:
        ordering = ("id", )
Exemple #2
0
class PeerCaUser(models.Model):
    user = models.ForeignKey(
        "NodeUser",
        help_text="User of ca node",
        null=True,
        on_delete=models.CASCADE,
    )
    username = models.CharField(
        help_text="If user not set, set username/password",
        max_length=64,
        default="",
    )
    password = models.CharField(
        help_text="If user not set, set username/password",
        max_length=64,
        default="",
    )
    type = models.CharField(
        help_text="User type of ca",
        max_length=64,
        choices=FabricCAUserType.to_choices(),
        default=FabricCAUserType.User.value,
    )
    peer_ca = models.ForeignKey(
        "PeerCa",
        help_text="Peer Ca configuration",
        null=True,
        on_delete=models.CASCADE,
    )