|
|
@@ -10,6 +10,7 @@
|
|
|
|
|
|
It has these top-level messages:
|
|
|
User
|
|
|
+ Role
|
|
|
*/
|
|
|
package authpb
|
|
|
|
|
|
@@ -39,8 +40,18 @@ func (m *User) Reset() { *m = User{} }
|
|
|
func (m *User) String() string { return proto.CompactTextString(m) }
|
|
|
func (*User) ProtoMessage() {}
|
|
|
|
|
|
+// Role is a single entry in the bucket authRoles
|
|
|
+type Role struct {
|
|
|
+ Name []byte `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Role) Reset() { *m = Role{} }
|
|
|
+func (m *Role) String() string { return proto.CompactTextString(m) }
|
|
|
+func (*Role) ProtoMessage() {}
|
|
|
+
|
|
|
func init() {
|
|
|
proto.RegisterType((*User)(nil), "authpb.User")
|
|
|
+ proto.RegisterType((*Role)(nil), "authpb.Role")
|
|
|
}
|
|
|
func (m *User) Marshal() (data []byte, err error) {
|
|
|
size := m.Size()
|
|
|
@@ -81,6 +92,32 @@ func (m *User) MarshalTo(data []byte) (int, error) {
|
|
|
return i, nil
|
|
|
}
|
|
|
|
|
|
+func (m *Role) Marshal() (data []byte, err error) {
|
|
|
+ size := m.Size()
|
|
|
+ data = make([]byte, size)
|
|
|
+ n, err := m.MarshalTo(data)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return data[:n], nil
|
|
|
+}
|
|
|
+
|
|
|
+func (m *Role) MarshalTo(data []byte) (int, error) {
|
|
|
+ var i int
|
|
|
+ _ = i
|
|
|
+ var l int
|
|
|
+ _ = l
|
|
|
+ if m.Name != nil {
|
|
|
+ if len(m.Name) > 0 {
|
|
|
+ data[i] = 0x12
|
|
|
+ i++
|
|
|
+ i = encodeVarintAuth(data, i, uint64(len(m.Name)))
|
|
|
+ i += copy(data[i:], m.Name)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return i, nil
|
|
|
+}
|
|
|
+
|
|
|
func encodeFixed64Auth(data []byte, offset int, v uint64) int {
|
|
|
data[offset] = uint8(v)
|
|
|
data[offset+1] = uint8(v >> 8)
|
|
|
@@ -129,6 +166,18 @@ func (m *User) Size() (n int) {
|
|
|
return n
|
|
|
}
|
|
|
|
|
|
+func (m *Role) Size() (n int) {
|
|
|
+ var l int
|
|
|
+ _ = l
|
|
|
+ if m.Name != nil {
|
|
|
+ l = len(m.Name)
|
|
|
+ if l > 0 {
|
|
|
+ n += 1 + l + sovAuth(uint64(l))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return n
|
|
|
+}
|
|
|
+
|
|
|
func sovAuth(x uint64) (n int) {
|
|
|
for {
|
|
|
n++
|
|
|
@@ -273,6 +322,87 @@ func (m *User) Unmarshal(data []byte) error {
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
+func (m *Role) Unmarshal(data []byte) error {
|
|
|
+ l := len(data)
|
|
|
+ iNdEx := 0
|
|
|
+ for iNdEx < l {
|
|
|
+ preIndex := iNdEx
|
|
|
+ var wire uint64
|
|
|
+ for shift := uint(0); ; shift += 7 {
|
|
|
+ if shift >= 64 {
|
|
|
+ return ErrIntOverflowAuth
|
|
|
+ }
|
|
|
+ if iNdEx >= l {
|
|
|
+ return io.ErrUnexpectedEOF
|
|
|
+ }
|
|
|
+ b := data[iNdEx]
|
|
|
+ iNdEx++
|
|
|
+ wire |= (uint64(b) & 0x7F) << shift
|
|
|
+ if b < 0x80 {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ fieldNum := int32(wire >> 3)
|
|
|
+ wireType := int(wire & 0x7)
|
|
|
+ if wireType == 4 {
|
|
|
+ return fmt.Errorf("proto: Role: wiretype end group for non-group")
|
|
|
+ }
|
|
|
+ if fieldNum <= 0 {
|
|
|
+ return fmt.Errorf("proto: Role: illegal tag %d (wire type %d)", fieldNum, wire)
|
|
|
+ }
|
|
|
+ switch fieldNum {
|
|
|
+ case 2:
|
|
|
+ if wireType != 2 {
|
|
|
+ return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
|
|
|
+ }
|
|
|
+ var byteLen int
|
|
|
+ for shift := uint(0); ; shift += 7 {
|
|
|
+ if shift >= 64 {
|
|
|
+ return ErrIntOverflowAuth
|
|
|
+ }
|
|
|
+ if iNdEx >= l {
|
|
|
+ return io.ErrUnexpectedEOF
|
|
|
+ }
|
|
|
+ b := data[iNdEx]
|
|
|
+ iNdEx++
|
|
|
+ byteLen |= (int(b) & 0x7F) << shift
|
|
|
+ if b < 0x80 {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if byteLen < 0 {
|
|
|
+ return ErrInvalidLengthAuth
|
|
|
+ }
|
|
|
+ postIndex := iNdEx + byteLen
|
|
|
+ if postIndex > l {
|
|
|
+ return io.ErrUnexpectedEOF
|
|
|
+ }
|
|
|
+ m.Name = append(m.Name[:0], data[iNdEx:postIndex]...)
|
|
|
+ if m.Name == nil {
|
|
|
+ m.Name = []byte{}
|
|
|
+ }
|
|
|
+ iNdEx = postIndex
|
|
|
+ default:
|
|
|
+ iNdEx = preIndex
|
|
|
+ skippy, err := skipAuth(data[iNdEx:])
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+ if skippy < 0 {
|
|
|
+ return ErrInvalidLengthAuth
|
|
|
+ }
|
|
|
+ if (iNdEx + skippy) > l {
|
|
|
+ return io.ErrUnexpectedEOF
|
|
|
+ }
|
|
|
+ iNdEx += skippy
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if iNdEx > l {
|
|
|
+ return io.ErrUnexpectedEOF
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
func skipAuth(data []byte) (n int, err error) {
|
|
|
l := len(data)
|
|
|
iNdEx := 0
|