fleet/server/mdm/android/android.go
Victor Lyuboslavsky 67b72764c5
Added Android activity and better handling of deleted users. (#26640)
For #26218

- Added `users_deleted` table to track user actions if the user was
actually deleted.
- Added enable/disable Android MDM activities

Note: I could not auto-generate fleet.Service mock because it has issues
with methods that don't return anything. I ended up using testify mock
instead.

# Checklist for submitter

- [x] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [x] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [x] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [x] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [x] Added/updated automated tests
- [x] Manual QA for all new/changed functionality
2025-02-27 14:19:15 -06:00

49 lines
1.1 KiB
Go

package android
import (
"time"
)
type SignupDetails struct {
Url string
Name string
}
type Enterprise struct {
ID uint `db:"id"`
EnterpriseID string `db:"enterprise_id"`
}
func (e Enterprise) Name() string {
return "enterprises/" + e.EnterpriseID
}
func (e Enterprise) IsValid() bool {
return e.EnterpriseID != ""
}
func (e Enterprise) AuthzType() string {
return "android_enterprise"
}
type EnterpriseDetails struct {
Enterprise
SignupName string `db:"signup_name"`
SignupToken string `db:"signup_token"`
TopicID string `db:"pubsub_topic_id"`
UserID uint `db:"user_id"`
}
type EnrollmentToken struct {
EnrollmentToken string `json:"android_enrollment_token"`
EnrollmentURL string `json:"android_enrollment_url"`
}
type Device struct {
ID uint `db:"id"`
HostID uint `db:"host_id"`
DeviceID string `db:"device_id"`
EnterpriseSpecificID *string `db:"enterprise_specific_id"`
AndroidPolicyID *uint `db:"android_policy_id"`
LastPolicySyncTime *time.Time `db:"last_policy_sync_time"`
}