github.com/juju/juju@v0.0.0-20240327075706-a90865de2538/core/permission/useraccess.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package permission 5 6 import ( 7 "time" 8 9 "github.com/juju/names/v5" 10 ) 11 12 // UserAccess represents a user access to a target whereas the user 13 // could represent a remote user or a user across multiple models the 14 // user access always represents a single user for a single target. 15 // There should be no more than one UserAccess per target/user pair. 16 // Many of these fields are storage artifacts but generate them from 17 // other fields implies out of band knowledge of other packages. 18 type UserAccess struct { 19 // UserID is the stored ID of the user. 20 UserID string 21 // UserTag is the tag for the user. 22 UserTag names.UserTag 23 // Object is the tag for the object of this access grant. 24 Object names.Tag 25 // Access represents the level of access subject has over object. 26 Access Access 27 // CreatedBy is the tag of the user that granted the access. 28 CreatedBy names.UserTag 29 // DateCreated is the date the user was created in UTC. 30 DateCreated time.Time 31 // DisplayName is the name we are showing for this user. 32 DisplayName string 33 // UserName is the actual username for this access. 34 UserName string 35 } 36 37 // IsEmptyUserAccess returns true if the passed UserAccess instance 38 // is empty. 39 func IsEmptyUserAccess(a UserAccess) bool { 40 return a == UserAccess{} 41 }