github.com/infraboard/keyauth@v0.8.1/apps/role/pb/request.proto (about)

     1  syntax = "proto3";
     2  
     3  package infraboard.keyauth.role;
     4  option go_package = "github.com/infraboard/keyauth/apps/role";
     5  
     6  import "apps/role/pb/enum.proto";
     7  import "github.com/infraboard/mcube/pb/page/page.proto";
     8  
     9  // CreateRoleRequest 创建角色请求
    10  message CreateRoleRequest {
    11      // 角色类型
    12      // @gotags: bson:"type" json:"type"
    13      RoleType type = 1;
    14      // 角色名称
    15      // @gotags: bson:"name" json:"name" validate:"required,lte=30"
    16      string name = 2;
    17      // 角色描述
    18      // @gotags: bson:"description" json:"description" validate:"lte=400"
    19      string description =3;
    20      // 角色关联的其他信息,比如展示的视图
    21      // @gotags: bson:"meta" json:"meta" validate:"lte=400"
    22      map<string,string> meta =4;
    23      // 所属域
    24      // @gotags: bson:"domain" json:"domain"
    25      string domain = 5;
    26      // 创建者ID
    27      // @gotags: bson:"create_by" json:"create_by"
    28      string create_by = 6; 
    29      // 读权限
    30      // @gotags: bson:"permissions" json:"permissions"
    31      repeated CreatePermssionRequest permissions = 9;                   
    32  }
    33  
    34  message CreatePermssionRequest {
    35      // 效力
    36      // @gotags: bson:"effect" json:"effect"
    37      EffectType effect = 1;
    38      // 服务ID
    39      // @gotags: bson:"service_id" json:"service_id"
    40      string service_id = 2;
    41      // 资源列表
    42      // @gotags: bson:"resource_name" json:"resource_name"
    43      string resource_name = 3;
    44      // 维度
    45      // @gotags: bson:"label_key" json:"label_key"
    46      string label_key = 4;
    47      // 适配所有值
    48      // @gotags: bson:"match_all" json:"match_all"
    49      bool match_all = 5;
    50      // 标识值
    51      // @gotags: bson:"label_values" json:"label_values"
    52      repeated string label_values = 6; 
    53  }
    54  
    55  // QueryRoleRequest 列表查询
    56  message QueryRoleRequest {
    57      // @gotags: json:"page"
    58     infraboard.mcube.page.PageRequest page = 1;
    59      // @gotags: json:"type"
    60      RoleType type = 2;
    61      // @gotags: json:"domain"
    62      string domain = 3;  
    63  }
    64  
    65  // DescribeRoleRequest role详情
    66  message DescribeRoleRequest {
    67      // @gotags: json:"id"
    68      string id = 1;
    69      // @gotags: json:"name,omitempty" validate:"required,lte=64"
    70      string name = 2;
    71      // @gotags: bson:"with_permissions" json:"with_permissions"
    72      bool with_permissions = 3;
    73      // @gotags: bson:"type" json:"type"
    74      RoleType type = 4;
    75  }
    76  
    77  // DeleteRoleRequest role删除
    78  message DeleteRoleRequest {
    79      // @gotags: json:"id" validate:"required,lte=64"
    80      string id = 1;
    81      // @gotags: json:"delete_policy"
    82      bool delete_policy = 2;
    83  }
    84  
    85  message QueryPermissionRequest {
    86      // @gotags: bson:"page" json:"page"
    87     infraboard.mcube.page.PageRequest page = 1;
    88      // @gotags: json:"role_id" validate:"required,lte=64"
    89      string role_id = 2;
    90      // @gotags: json:"skip_itmes"
    91      bool skip_itmes = 3;
    92  }
    93  
    94  // DescribeRoleRequest role详情
    95  message DescribePermissionRequest {
    96      // @gotags: json:"id"
    97      string id = 1;
    98  }
    99  
   100  message AddPermissionToRoleRequest {
   101     // 创建者ID
   102      // @gotags: json:"create_by" validate:"required"
   103      string create_by = 3; 
   104      // @gotags: json:"role_id" validate:"required,lte=64"
   105      string role_id = 1;
   106      // @gotags: json:"permissions" validate:"required"
   107      repeated CreatePermssionRequest permissions = 2;
   108  }
   109  
   110  message RemovePermissionFromRoleRequest {
   111      // @gotags: json:"role_id" validate:"required,lte=64"
   112      string role_id = 1;
   113      // @gotags: json:"remove_all"
   114      bool remove_all = 2;
   115      // @gotags: json:"permission_id"
   116      repeated string permission_id = 3;
   117  }
   118  
   119  message UpdatePermissionRequest {
   120      // permission id
   121      // @gotags: json:"id" validate:"required,lte=64"
   122      string id = 1;
   123      // 维度
   124      // @gotags: json:"label_key"
   125      string label_key = 2;
   126      // 适配所有值
   127      // @gotags: json:"match_all"
   128      bool match_all = 3;
   129      // 标识值
   130      // @gotags: json:"label_values"
   131      repeated string label_values = 4;     
   132  }