forked from gitea-group-sync/gitea-group-sync
-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
136 lines (113 loc) · 4.34 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package main
import (
"code.gitea.io/sdk/gitea"
"gopkg.in/ldap.v3"
)
func (o *GiteaOrganization) String() string {
return o.UserName
}
type GiteaOrganization struct {
*gitea.Organization
RepoAdminChangeTeamAccess bool `json:"repoAdminChangeTeamAccess"`
}
type GiteaTeam struct {
*gitea.Team
}
type GiteaCreateTeamOpts struct {
Permission gitea.AccessMode
CanCreateOrgRepo bool
IncludesAllRepositories bool
Units []gitea.RepoUnitType
}
type GiteaUser struct {
*gitea.User
}
type GiteaAccount struct {
ID int `json:"id"`
FullName string `json:"full_name"`
Login string `json:"login"`
Email string `json:"email"`
}
type GiteaClient struct {
*gitea.Client
Token []string `mapstructure:"token"`
BaseURL string `mapstructure:"base_url"`
}
// Config describes the settings of the application. This structure is used in the settings-import process.
type Config struct {
GiteaClient *GiteaClient `mapstructure:"gitea"`
LDAP LDAP `mapstructure:"ldap"`
CronTimer string `mapstructure:"cron_timer"`
SyncConfig SyncConfig `mapstructure:"sync_config"`
}
type SyncConfig struct {
CreateGroups bool `mapstructure:"create_groups"`
FullSync bool `mapstructure:"full_sync"`
Defaults struct {
Organization struct {
RepoAdminChangeTeamAccess bool `mapstructure:"repo_admin_change_team_access"`
Visibility string `mapstructure:"visibility"`
} `mapstructure:"organization"`
Team struct {
CanCreateOrgRepo bool `mapstructure:"can_create_org_repo"`
IncludesAllRepositories bool `mapstructure:"includes_all_repositories"`
Permission gitea.AccessMode `mapstructure:"permission"`
Units []gitea.RepoUnitType `mapstructure:"units"`
} `mapstructure:"team"`
} `mapstructure:"defaults"`
}
type LDAP struct {
URL string `mapstructure:"url"`
Port int `mapstructure:"port"`
UseTLS bool `mapstructure:"use_tls"`
AllowInsecureTLS bool `mapstructure:"allow_insecure_tls"`
BindDN string `mapstructure:"bind_dn"`
BindPassword string `mapstructure:"bind_password"`
UserFilter string `mapstructure:"user_filter"`
UserSearchBase string `mapstructure:"user_search_base"`
UserUsernameAttribute string `mapstructure:"user_username_attribute"`
UserFullNameAttribute string `mapstructure:"user_fullname_attribute"`
UserFirstNameAttribute string `mapstructure:"user_first_name_attribute"`
UserSurnameAttribute string `mapstructure:"user_surname_attribute"`
UserEmailAttribute string `mapstructure:"user_email_attribute"`
UserPublicSSHKeyAttribute string `mapstructure:"user_public_ssh_key_attribute"`
UserAvatarAttribute string `mapstructure:"user_avatar_attribute"`
ExcludeUsers []string `mapstructure:"exclude_users"`
ExcludeUsersRegex string `mapstructure:"exclude_users_regex"`
AdminFilter string `mapstructure:"admin_filter"`
RestrictedFilter string `mapstructure:"restricted_filter"`
GroupSearchBase string `mapstructure:"group_search_base"`
GroupFilter string `mapstructure:"group_filter"`
GroupNameAttribute string `mapstructure:"group_name_attribute"`
GroupFullNameAttribute string `mapstructure:"group_fullname_attribute"`
GroupDescriptionAttribute string `mapstructure:"group_description_attribute"`
SubGroupSearchBase string `mapstructure:"subgroup_search_base"`
SubGroupFilter string `mapstructure:"subgroup_filter"`
SubgroupNameAttribute string `mapstructure:"subgroup_name_attribute"`
SubgroupDescriptionAttribute string `mapstructure:"subgroup_description_attribute"`
ExcludeGroups []string `mapstructure:"exclude_groups"`
ExcludeGroupsRegex string `mapstructure:"exclude_groups_regex"`
ExcludeSubgroups []string `mapstructure:"exclude_subgroups"`
ExcludeSubgroupsRegex string `mapstructure:"exclude_subgroups_regex"`
ldap.Client
}
type Directory struct {
Organizations map[string]*LDAPOrganization
Users map[string]*LDAPUser
}
type LDAPOrganization struct {
Name string
*ldap.Entry
Teams map[string]*LDAPTeam
}
type LDAPTeam struct {
Name string
*ldap.Entry
Users map[string]*LDAPUser
}
type LDAPUser struct {
Name string
Restricted *bool
Admin *bool
*ldap.Entry
}