github.com/cs3org/reva/v2@v2.27.7/pkg/events/users.go (about) 1 // Copyright 2018-2022 CERN 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 // In applying this license, CERN does not waive the privileges and immunities 16 // granted to it by virtue of its status as an Intergovernmental Organization 17 // or submit itself to any jurisdiction. 18 19 package events 20 21 import ( 22 "encoding/json" 23 24 user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" 25 types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" 26 ) 27 28 // UserCreated is emitted when a user was created 29 type UserCreated struct { 30 Executant *user.UserId 31 UserID string 32 Timestamp *types.Timestamp 33 } 34 35 // Unmarshal to fulfill umarshaller interface 36 func (UserCreated) Unmarshal(v []byte) (interface{}, error) { 37 e := UserCreated{} 38 err := json.Unmarshal(v, &e) 39 return e, err 40 } 41 42 // UserDeleted is emitted when a user was deleted 43 type UserDeleted struct { 44 Executant *user.UserId 45 UserID string 46 Timestamp *types.Timestamp 47 } 48 49 // Unmarshal to fulfill umarshaller interface 50 func (UserDeleted) Unmarshal(v []byte) (interface{}, error) { 51 e := UserDeleted{} 52 err := json.Unmarshal(v, &e) 53 return e, err 54 } 55 56 // UserFeature represents a user feature 57 type UserFeature struct { 58 Name string 59 Value string 60 OldValue *string 61 } 62 63 // UserFeatureChanged is emitted when a user feature was changed 64 type UserFeatureChanged struct { 65 Executant *user.UserId 66 UserID string 67 Features []UserFeature 68 Timestamp *types.Timestamp 69 } 70 71 // Unmarshal to fulfill umarshaller interface 72 func (UserFeatureChanged) Unmarshal(v []byte) (interface{}, error) { 73 e := UserFeatureChanged{} 74 err := json.Unmarshal(v, &e) 75 return e, err 76 } 77 78 // PersonalDataExtracted is emitted when a user data extraction is finished 79 type PersonalDataExtracted struct { 80 Executant *user.UserId 81 Timestamp *types.Timestamp 82 ErrorMsg string 83 } 84 85 // Unmarshal to fulfill umarshaller interface 86 func (PersonalDataExtracted) Unmarshal(v []byte) (interface{}, error) { 87 e := PersonalDataExtracted{} 88 err := json.Unmarshal(v, &e) 89 return e, err 90 } 91 92 // BackchannelLogout is emitted when the callback from the identity provider is received 93 type BackchannelLogout struct { 94 Executant *user.UserId 95 SessionId string 96 Timestamp *types.Timestamp 97 } 98 99 // Unmarshal to fulfill umarshaller interface 100 func (BackchannelLogout) Unmarshal(v []byte) (interface{}, error) { 101 e := BackchannelLogout{} 102 err := json.Unmarshal(v, &e) 103 return e, err 104 } 105 106 // UserSignedIn is emitted when a user signs in 107 type UserSignedIn struct { 108 Executant *user.UserId 109 Timestamp *types.Timestamp 110 } 111 112 // Unmarshal to fulfill umarshaller interface 113 func (UserSignedIn) Unmarshal(v []byte) (interface{}, error) { 114 e := UserSignedIn{} 115 err := json.Unmarshal(v, &e) 116 return e, err 117 }