Documentation ¶
Index ¶
- Constants
- Variables
- func MatchesApiKey(hiddenApiKey, apiKey string) bool
- type AccessibleItem
- type ApiKey
- type Auth
- type FormComponentItem
- type FormItem
- type GroupAndOthers
- type Lang
- type MemoryAuth
- type NameFormat
- type Permission
- func (me Permission) IsGroupRead() bool
- func (me Permission) IsGroupWrite() bool
- func (me Permission) IsOthersRead() bool
- func (me Permission) IsOthersWrite() bool
- func (me Permission) IsRead() bool
- func (me Permission) IsWrite() bool
- func (me Permission) MarshalJSON() ([]byte, error)
- func (me Permission) String() string
- func (me Permission) ToReadablePattern() string
- type Permissions
- func (me *Permissions) Change(auth Auth, changed *Permissions) *Permissions
- func (me *Permissions) IsPublishedFor(auth Auth) bool
- func (me *Permissions) IsPublishedOrReadGrantedFor(auth Auth) bool
- func (me *Permissions) IsReadGrantedFor(auth Auth) bool
- func (me *Permissions) IsWriteGrantedFor(auth Auth) bool
- func (me *Permissions) OwnedBy(auth Auth) bool
- func (me *Permissions) UpdateUserID(usrOldIdNewID map[string]string)
- func (me *Permissions) UserIdsMap(usrIds map[string]bool)
- type Role
- func (r Role) AllowedToCreateEntities() bool
- func (r Role) AllowedToCreateUserData() bool
- func (r Role) Is(pr Role) bool
- func (r Role) IsGrantedFor(pr Role) bool
- func (r Role) IsGrantedForUserModifications() bool
- func (r Role) Lower() string
- func (r Role) RolesInRange() []RoleSet
- func (r Role) RolesInRangeWithNameFormat(nf NameFormat) []RoleSet
- func (r Role) String() string
- func (r Role) Title() string
- func (r Role) Upper() string
- type RoleSet
- type Session
- type Settings
- type SignatureRequestItem
- type TemplateItem
- type TemplateLangMap
- type TokenRequest
- type TokenType
- type User
- func (me *User) AccessRights() Role
- func (me *User) CheckIfAuthIsAllowedToReadPersonalData(auth Auth) bool
- func (me *User) Close()
- func (me *User) GetVersion() int
- func (me *User) IsGrantedFor(role Role) bool
- func (me *User) SetApiKey(name string) (*ApiKey, error)
- func (me *User) String() string
- func (me *User) UserID() string
- type UserData
- type UserDataItem
- type WorkflowItem
- type WorkflowPaymentItem
Constants ¶
const ( PaymentStatusCreated = "created" PaymentStatusPending = "pending" PaymentStatusConfirmed = "confirmed" PaymentStatusCancelled = "cancelled" PaymentStatusRedeemed = "redeemed" PaymentStatusDeleted = "deleted" PaymentStatusTimeout = "timeout" )
const ( PUBLIC Role = -1 //Unset/Zero value Role = 0 GUEST Role = 1 USER Role = 5 CREATOR Role = 7 ADMIN Role = 10 SUPERADMIN Role = 50 ROOT Role = 100 Title NameFormat = 1 Lower NameFormat = 2 Upper NameFormat = 3 )
const ApiKeyLength = 40 //example: f235122f9a1e4884123456788a2126f8dd76996b
Variables ¶
var ErrAuthorityInvalid = fmt.Errorf("invalid authority key")
var ErrAuthorityMissing = fmt.Errorf("authority missing")
var ErrAuthorityNotFound = fmt.Errorf("user not found for key")
Functions ¶
func MatchesApiKey ¶
Types ¶
type AccessibleItem ¶
type FormComponentItem ¶
type FormComponentItem struct { Permissions ID string `json:"id" storm:"id"` Name string `json:"name" storm:"index"` Detail string `json:"detail"` //Permissions Permissions `json:"permissions"` Updated time.Time `json:"updated" storm:"index"` Created time.Time `json:"created" storm:"index"` //Settings and Template are just passing through Settings compatability.CarriedJsonRaw `json:"settings"` Template string `json:"template"` }
func (*FormComponentItem) GetVersion ¶
func (me *FormComponentItem) GetVersion() int
type FormItem ¶
type FormItem struct { Permissions ID string `json:"id" storm:"id"` Name string `json:"name" storm:"index"` Detail string `json:"detail"` //Permissions Permissions `json:"permissions"` Updated time.Time `json:"updated" storm:"index"` Created time.Time `json:"created" storm:"index"` //Data contains the form source Data compatability.CarriedStringMap `json:"data"` }
func (*FormItem) GetVersion ¶
type GroupAndOthers ¶
type GroupAndOthers struct { //Allowed to modify: @Owner only! Group Role `json:"group,omitempty"` //Rights pattern: group others // -- -- //default value is: ---- //example for group and others with read perm: r-r- //Allowed to modify: @Owner only! Rights Permission `json:"rights,omitempty"` }
func (*GroupAndOthers) IsGroupRead ¶
func (me *GroupAndOthers) IsGroupRead(auth Auth) bool
func (*GroupAndOthers) IsGroupWrite ¶
func (me *GroupAndOthers) IsGroupWrite(auth Auth) bool
func (*GroupAndOthers) IsOthersRead ¶
func (me *GroupAndOthers) IsOthersRead() bool
func (*GroupAndOthers) IsOthersWrite ¶
func (me *GroupAndOthers) IsOthersWrite() bool
type MemoryAuth ¶
type NameFormat ¶
type NameFormat int
type Permission ¶
type Permission []byte
Permission holds an byte slice for the pattern --/rw or ----/r-r- and so on none read write 0 == - | 1 == r | 2 == w to support []byte we implement the json marshaller interface otherwise use []int
func PermissionFrom ¶
func PermissionFrom(readablePattern string) (Permission, error)
func (Permission) IsGroupRead ¶
func (me Permission) IsGroupRead() bool
func (Permission) IsGroupWrite ¶
func (me Permission) IsGroupWrite() bool
func (Permission) IsOthersRead ¶
func (me Permission) IsOthersRead() bool
func (Permission) IsOthersWrite ¶
func (me Permission) IsOthersWrite() bool
func (Permission) IsRead ¶
func (me Permission) IsRead() bool
func (Permission) IsWrite ¶
func (me Permission) IsWrite() bool
func (Permission) MarshalJSON ¶
func (me Permission) MarshalJSON() ([]byte, error)
func (Permission) String ¶
func (me Permission) String() string
func (Permission) ToReadablePattern ¶
func (me Permission) ToReadablePattern() string
type Permissions ¶
type Permissions struct { //Allowed to modify: @Owner only! Owner string `json:"owner,omitempty"` //Grant can be modified by the owner only and is an optional field to whitelist user's directly //Allowed to modify: everyone with write rights! Grant map[string]Permission `json:"grant,omitempty"` GroupAndOthers GroupAndOthers `json:"groupAndOthers,omitempty"` //Accessible by everyone who has the ID //Allowed to modify: everyone with write rights! PublicByID Permission `json:"publicByID,omitempty"` //Execute only! If read or write not set. Published bool `json:"published"` }
func (*Permissions) Change ¶
func (me *Permissions) Change(auth Auth, changed *Permissions) *Permissions
TODO improve perm modification
func (*Permissions) IsPublishedFor ¶
func (me *Permissions) IsPublishedFor(auth Auth) bool
func (*Permissions) IsPublishedOrReadGrantedFor ¶
func (me *Permissions) IsPublishedOrReadGrantedFor(auth Auth) bool
func (*Permissions) IsReadGrantedFor ¶
func (me *Permissions) IsReadGrantedFor(auth Auth) bool
IsReadGrantedFor is checking whether the User has read rights or not Rights pattern: group others
-- --
default value is: ---- example for group and others with read perm: r-r-
func (*Permissions) IsWriteGrantedFor ¶
func (me *Permissions) IsWriteGrantedFor(auth Auth) bool
IsWriteGrantedFor is checking whether the User has write rights or not Rights pattern: group others
-- --
default value is: ---- example for group and others with read perm: r-r-
func (*Permissions) OwnedBy ¶
func (me *Permissions) OwnedBy(auth Auth) bool
func (*Permissions) UpdateUserID ¶
func (me *Permissions) UpdateUserID(usrOldIdNewID map[string]string)
func (*Permissions) UserIdsMap ¶
func (me *Permissions) UserIdsMap(usrIds map[string]bool)
type Role ¶
type Role int
func StringToRole ¶
StringToRole takes role string case insensitive and returns a GUEST role if no role was found with the provided string
func (Role) AllowedToCreateEntities ¶
func (Role) AllowedToCreateUserData ¶
func (Role) IsGrantedFor ¶
IsGrantedFor checks if current is higher or equal to the provided role
func (Role) IsGrantedForUserModifications ¶
IsGrantedForUserModifications checks if current is higher or equal to SUPERADMIN
func (Role) RolesInRange ¶
RolesInRange provides all roles hierarchically sorted in your range
func (Role) RolesInRangeWithNameFormat ¶
func (r Role) RolesInRangeWithNameFormat(nf NameFormat) []RoleSet
type Settings ¶
type Settings struct { DocumentServiceUrl string `` /* 159-byte string literal not displayed */ PlatformDomain string `json:"platformDomain" validate:"required=true" default:"" usage:"Platform Domain used to for links to Platform"` DataDir string `json:"dataDir" default:"/data/hosted" usage:"Database directory path. All data will be stored here."` DefaultRole string `` /* 132-byte string literal not displayed */ SessionExpiry string `` /* 140-byte string literal not displayed */ CacheExpiry string `` /* 133-byte string literal not displayed */ BlockchainNet string `` /* 153-byte string literal not displayed */ InfuraApiKey string `json:"infuraApiKey" validate:"required=true" usage:"API Key to access Infura node."` BlockchainContractAddress string `` /* 156-byte string literal not displayed */ SparkpostApiKey string `json:"sparkpostApiKey" validate:"required=true" usage:"Sparkpost API key which will be used to send out emails."` EmailFrom string `json:"emailFrom" validate:"required=true,email=true" usage:"Email that is being used to send out emails."` LogPath string `json:"logPath" default:"./log" usage:"Location of the log file of this service."` DefaultWorkflowIds string `json:"defaultWorkflowIds" usage:"Workflow IDs to set to clone and add to a new user"` AirdropEnabled string `json:"airdropEnabled" validate:"required=true" default:"false" usage:"Enables/Disables the XES & Ether airdrop feature."` AirdropAmountXES string `json:"airdropAmountXES" default:"0" usage:"Amount of XES to airdrop to newly registered users."` AirdropAmountEther string `json:"airdropAmountEther" default:"0" usage:"Amount of Ether to airdrop to newly registered users."` DatabaseEngine string `json:"databaseEngine" default:"storm" usage:"Selects database engine, supported values: storm, mongo."` DatabaseURI string `json:"DatabaseURI" default:"" usage:"Sets database connection string, not required for embedded databases."` TestMode string `json:"testMode" default:"false" usage:"Run the server in test mode =NOT FOR PRODUCTION=."` AllowHttp string `json:"allowHttp" default:"false" usage:"Allow the use of HTTP =NOT FOR PRODUCTION=."` }
func NewDefaultSettings ¶
func NewDefaultSettings() *Settings
type SignatureRequestItem ¶
type SignatureRequestItem struct { ID string `storm:"id"` // DocumentID, ie. 8b5e1460-e456-4aea-91dd-efd7f6ff9b40 DocId string `json:"docid" storm:"index"` // DataPath, ie. docs[0] DocPath string `json:"docpath" storm:"index"` // Keccak256 of Filecontent Hash string `json:"hash"` // RequestorEthAddress Requestor string `json:"requestor" storm:"index"` // Timestamp for requested, revoked, rejected RequestedAt time.Time `json:"requestedAt"` RevokedAt time.Time `json:"revokedAt"` RejectedAt time.Time `json:"rejectedAt"` // SignatoryEthAddress Signatory string `json:"signatory" storm:"index"` Revoked bool `json:"revoked"` Rejected bool `json:"rejected"` }
func (*SignatureRequestItem) GetVersion ¶
func (me *SignatureRequestItem) GetVersion() int
type TemplateItem ¶
type TemplateItem struct { Permissions ID string `json:"id" storm:"id"` Name string `json:"name" storm:"index"` Detail string `json:"detail"` //Permissions Permissions `json:"permissions"` Updated time.Time `json:"updated" storm:"index"` Created time.Time `json:"created" storm:"index"` Data TemplateLangMap `json:"data"` }
func (*TemplateItem) Clone ¶
func (me *TemplateItem) Clone() TemplateItem
func (*TemplateItem) GetTemplate ¶
func (me *TemplateItem) GetTemplate(lang string) (*file.IO, error)
func (*TemplateItem) GetVersion ¶
func (me *TemplateItem) GetVersion() int
type TemplateLangMap ¶
type TokenRequest ¶
type User ¶
type User struct { ID string `json:"id" storm:"id"` Name string `json:"name" storm:"index"` Detail string `json:"detail"` Updated time.Time `json:"updated" storm:"index"` Created time.Time `json:"created" storm:"index"` //Item Email string `json:"email" storm:"unique"` Role Role `json:"role,omitempty"` Data interface{} `json:"data,omitempty"` Active bool `json:"active"` EthereumAddr string `json:"etherPK" storm:"index"` PhotoPath string `json:"-"` Photo string `json:"photo"` //the user is able to tell if he lets other people see his photo, name or email instead of just the blockchain address WantToBeFound bool `json:"wantToBeFound"` ApiKeys []*ApiKey `json:"apiKeys"` }
func (*User) AccessRights ¶
func (*User) CheckIfAuthIsAllowedToReadPersonalData ¶
func (*User) GetVersion ¶
func (*User) IsGrantedFor ¶
IsGrantedFor check if user has enough permissions
type UserData ¶
type UserData struct { ID string `json:"id" storm:"id"` Name string `json:"name" storm:"index"` Detail string `json:"detail"` Permissions Permissions `json:"permissions"` Updated time.Time `json:"updated" storm:"index"` Created time.Time `json:"created" storm:"index"` WorkflowID string `json:"workflowId"` Lang string `json:"lang"` LangForm string `json:"langForm"` LangTmpl string `json:"langTmpl"` Finished bool `json:"finished"` Data interface{} `json:"data"` }
type UserDataItem ¶
type UserDataItem struct { Permissions ID string `json:"id" storm:"id"` Name string `json:"name" storm:"index"` Detail string `json:"detail"` //Permissions Permissions `json:"permissions"` WorkflowID string `json:"workflowID"` Finished bool `json:"finished"` Updated time.Time `json:"updated" storm:"index"` Created time.Time `json:"created" storm:"index"` Data compatability.CarriedStringMap `json:"data"` }
func (*UserDataItem) GetAllFileInfos ¶
func (me *UserDataItem) GetAllFileInfos() []*file.IO
func (*UserDataItem) GetVersion ¶
func (me *UserDataItem) GetVersion() int
type WorkflowItem ¶
type WorkflowItem struct { Permissions ID string `json:"id" storm:"id"` Name string `json:"name" storm:"index"` Detail string `json:"detail"` //Permissions Permissions `json:"permissions"` Updated time.Time `json:"updated" storm:"index"` Created time.Time `json:"created" storm:"index"` Price uint64 `json:"price" storm:"index"` Data *workflow.Workflow `json:"data"` OwnerEthAddress string `json:"ownerEthAddress"` //only used in frontend Deactivated bool `json:"deactivated"` }
func (*WorkflowItem) Clone ¶
func (me *WorkflowItem) Clone() WorkflowItem
func (*WorkflowItem) GetVersion ¶
func (me *WorkflowItem) GetVersion() int
type WorkflowPaymentItem ¶
type WorkflowPaymentItem struct { //save from who payment ID string `json:"id" storm:"id,unique"` TxHash string `json:"hash" storm:"index,unique"` WorkflowID string `json:"workflowID" storm:"index"` From string `json:"from" storm:"index"` To string `json:"to"` Xes uint64 `json:"xes"` Status string `json:"status" storm:"index"` CreatedAt time.Time `json:"createdAt"` }
func (*WorkflowPaymentItem) GetVersion ¶
func (me *WorkflowPaymentItem) GetVersion() int