Initial commit
This commit is contained in:
51
modules/military/build.gradle.kts
Normal file
51
modules/military/build.gradle.kts
Normal file
@@ -0,0 +1,51 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("kotlin-kapt")
|
||||
id("dagger.hilt.android.plugin")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.smoa.modules.military"
|
||||
compileSdk = AppConfig.compileSdk
|
||||
|
||||
defaultConfig {
|
||||
minSdk = AppConfig.minSdk
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.4"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":core:common"))
|
||||
implementation(project(":core:auth"))
|
||||
implementation(project(":core:security"))
|
||||
implementation(project(":core:barcode"))
|
||||
|
||||
implementation(platform(Dependencies.composeBom))
|
||||
implementation(Dependencies.composeUi)
|
||||
implementation(Dependencies.composeMaterial3)
|
||||
implementation(Dependencies.androidxCoreKtx)
|
||||
|
||||
implementation(Dependencies.hiltAndroid)
|
||||
kapt(Dependencies.hiltAndroidCompiler)
|
||||
|
||||
implementation(Dependencies.coroutinesCore)
|
||||
implementation(Dependencies.coroutinesAndroid)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.smoa.modules.military
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun MilitaryModule(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.padding(16.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Military Operations",
|
||||
style = MaterialTheme.typography.headlineMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.smoa.modules.military.domain
|
||||
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Document classification marking manager per DOD standards.
|
||||
*/
|
||||
@Singleton
|
||||
class ClassificationManager @Inject constructor() {
|
||||
|
||||
/**
|
||||
* Get classification banner text.
|
||||
*/
|
||||
fun getClassificationBanner(level: ClassificationLevel): String {
|
||||
return when (level) {
|
||||
ClassificationLevel.UNCLASSIFIED -> "UNCLASSIFIED"
|
||||
ClassificationLevel.CONFIDENTIAL -> "CONFIDENTIAL"
|
||||
ClassificationLevel.SECRET -> "SECRET"
|
||||
ClassificationLevel.TOP_SECRET -> "TOP SECRET"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has clearance for classification level.
|
||||
*/
|
||||
fun hasClearance(userClearance: ClassificationLevel, documentLevel: ClassificationLevel): Boolean {
|
||||
val clearanceHierarchy = mapOf(
|
||||
ClassificationLevel.UNCLASSIFIED to 0,
|
||||
ClassificationLevel.CONFIDENTIAL to 1,
|
||||
ClassificationLevel.SECRET to 2,
|
||||
ClassificationLevel.TOP_SECRET to 3
|
||||
)
|
||||
|
||||
val userLevel = clearanceHierarchy[userClearance] ?: -1
|
||||
val docLevel = clearanceHierarchy[documentLevel] ?: Int.MAX_VALUE
|
||||
|
||||
return userLevel >= docLevel
|
||||
}
|
||||
}
|
||||
|
||||
enum class ClassificationLevel {
|
||||
UNCLASSIFIED,
|
||||
CONFIDENTIAL,
|
||||
SECRET,
|
||||
TOP_SECRET
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.smoa.modules.military.domain
|
||||
|
||||
import java.util.Date
|
||||
|
||||
/**
|
||||
* Military credential data model per MIL-STD-129.
|
||||
*/
|
||||
data class MilitaryCredential(
|
||||
val credentialId: String,
|
||||
val serviceCode: String, // Service branch code
|
||||
val rank: String?,
|
||||
val lastName: String,
|
||||
val firstName: String,
|
||||
val middleInitial: String?,
|
||||
val socialSecurityNumber: String,
|
||||
val dateOfBirth: Date,
|
||||
val expirationDate: Date,
|
||||
val issueDate: Date,
|
||||
val cardNumber: String,
|
||||
val unit: String?,
|
||||
val clearanceLevel: ClearanceLevel?
|
||||
)
|
||||
|
||||
enum class ClearanceLevel {
|
||||
CONFIDENTIAL,
|
||||
SECRET,
|
||||
TOP_SECRET,
|
||||
TS_SCI // Top Secret - Sensitive Compartmented Information
|
||||
}
|
||||
|
||||
enum class ServiceBranch {
|
||||
ARMY,
|
||||
NAVY,
|
||||
AIR_FORCE,
|
||||
MARINES,
|
||||
COAST_GUARD,
|
||||
SPACE_FORCE
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.smoa.modules.military.domain
|
||||
|
||||
import com.smoa.core.security.AuditLogger
|
||||
import com.smoa.core.security.AuditEventType
|
||||
import java.util.Date
|
||||
import java.util.UUID
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Military operations service.
|
||||
*/
|
||||
@Singleton
|
||||
class MilitaryService @Inject constructor(
|
||||
private val classificationManager: ClassificationManager,
|
||||
private val auditLogger: AuditLogger
|
||||
) {
|
||||
|
||||
/**
|
||||
* Create military credential.
|
||||
*/
|
||||
suspend fun createMilitaryCredential(
|
||||
serviceCode: String,
|
||||
rank: String?,
|
||||
lastName: String,
|
||||
firstName: String,
|
||||
socialSecurityNumber: String,
|
||||
dateOfBirth: Date,
|
||||
expirationDate: Date,
|
||||
unit: String?,
|
||||
clearanceLevel: ClearanceLevel?
|
||||
): Result<MilitaryCredential> {
|
||||
return try {
|
||||
val credential = MilitaryCredential(
|
||||
credentialId = UUID.randomUUID().toString(),
|
||||
serviceCode = serviceCode,
|
||||
rank = rank,
|
||||
lastName = lastName,
|
||||
firstName = firstName,
|
||||
middleInitial = null,
|
||||
socialSecurityNumber = socialSecurityNumber,
|
||||
dateOfBirth = dateOfBirth,
|
||||
expirationDate = expirationDate,
|
||||
issueDate = Date(),
|
||||
cardNumber = UUID.randomUUID().toString(),
|
||||
unit = unit,
|
||||
clearanceLevel = clearanceLevel
|
||||
)
|
||||
|
||||
auditLogger.logEvent(
|
||||
AuditEventType.CREDENTIAL_ACCESS,
|
||||
userId = firstName,
|
||||
module = "military",
|
||||
details = "Military credential created: ${credential.credentialId}"
|
||||
)
|
||||
|
||||
Result.success(credential)
|
||||
} catch (e: Exception) {
|
||||
Result.failure(e)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check classification access.
|
||||
*/
|
||||
fun checkClassificationAccess(userClearance: ClearanceLevel, documentLevel: ClassificationLevel): Boolean {
|
||||
val userLevel = when (userClearance) {
|
||||
ClearanceLevel.CONFIDENTIAL -> ClassificationLevel.CONFIDENTIAL
|
||||
ClearanceLevel.SECRET -> ClassificationLevel.SECRET
|
||||
ClearanceLevel.TOP_SECRET, ClearanceLevel.TS_SCI -> ClassificationLevel.TOP_SECRET
|
||||
}
|
||||
return classificationManager.hasClearance(userLevel, documentLevel)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.smoa.modules.military.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun MilitaryCredentialScreen(modifier: Modifier = Modifier) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.padding(16.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Military Credential",
|
||||
style = MaterialTheme.typography.headlineMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user