|
|
@@ -148,16 +148,17 @@ export function DataAccessSettings({
|
|
|
const security = getSecurityLevel();
|
|
|
const SecurityIcon = security.icon;
|
|
|
|
|
|
- const renderPolicyOptions = (dataType: 'products' | 'customers' | 'orders', policyKey: keyof AccessPolicySettings, isPII: boolean = false) => {
|
|
|
+ const renderPolicyOptions = (dataType: 'products' | 'customers' | 'orders', policyKey: keyof AccessPolicySettings, isPII: boolean = false, isDisabled: boolean = false) => {
|
|
|
return (
|
|
|
<RadioGroup
|
|
|
value={policies[policyKey]}
|
|
|
onValueChange={(value) => handlePolicyChange(dataType, value as DataAccessPolicy)}
|
|
|
className="space-y-3 mt-3"
|
|
|
+ disabled={isDisabled}
|
|
|
>
|
|
|
- <div className="flex items-start space-x-3 p-3 rounded-md bg-slate-600/30 hover:bg-slate-600/50 transition-colors">
|
|
|
- <RadioGroupItem value="sync" id={`${dataType}-sync`} className="mt-1" disabled={saving} />
|
|
|
- <Label htmlFor={`${dataType}-sync`} className="cursor-pointer flex-1">
|
|
|
+ <div className={`flex items-start space-x-3 p-3 rounded-md bg-slate-600/30 ${isDisabled ? 'opacity-60 cursor-not-allowed' : 'hover:bg-slate-600/50'} transition-colors`}>
|
|
|
+ <RadioGroupItem value="sync" id={`${dataType}-sync`} className="mt-1" disabled={saving || isDisabled} />
|
|
|
+ <Label htmlFor={`${dataType}-sync`} className={`flex-1 ${isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'}`}>
|
|
|
<div className="flex items-center gap-2 mb-1">
|
|
|
<Database className="w-4 h-4 text-cyan-400" />
|
|
|
<span className="text-white font-medium">Sync & Cache</span>
|
|
|
@@ -169,9 +170,9 @@ export function DataAccessSettings({
|
|
|
</Label>
|
|
|
</div>
|
|
|
|
|
|
- <div className="flex items-start space-x-3 p-3 rounded-md bg-slate-600/30 hover:bg-slate-600/50 transition-colors">
|
|
|
- <RadioGroupItem value="api_only" id={`${dataType}-api`} className="mt-1" disabled={saving} />
|
|
|
- <Label htmlFor={`${dataType}-api`} className="cursor-pointer flex-1">
|
|
|
+ <div className={`flex items-start space-x-3 p-3 rounded-md bg-slate-600/30 ${isDisabled ? 'opacity-60 cursor-not-allowed' : 'hover:bg-slate-600/50'} transition-colors`}>
|
|
|
+ <RadioGroupItem value="api_only" id={`${dataType}-api`} className="mt-1" disabled={saving || isDisabled} />
|
|
|
+ <Label htmlFor={`${dataType}-api`} className={`flex-1 ${isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'}`}>
|
|
|
<div className="flex items-center gap-2 mb-1">
|
|
|
<Cloud className="w-4 h-4 text-blue-400" />
|
|
|
<span className="text-white font-medium">API Access Only</span>
|
|
|
@@ -183,9 +184,9 @@ export function DataAccessSettings({
|
|
|
</Label>
|
|
|
</div>
|
|
|
|
|
|
- <div className="flex items-start space-x-3 p-3 rounded-md bg-slate-600/30 hover:bg-slate-600/50 transition-colors">
|
|
|
- <RadioGroupItem value="not_allowed" id={`${dataType}-none`} className="mt-1" disabled={saving} />
|
|
|
- <Label htmlFor={`${dataType}-none`} className="cursor-pointer flex-1">
|
|
|
+ <div className={`flex items-start space-x-3 p-3 rounded-md bg-slate-600/30 ${isDisabled ? 'opacity-60 cursor-not-allowed' : 'hover:bg-slate-600/50'} transition-colors`}>
|
|
|
+ <RadioGroupItem value="not_allowed" id={`${dataType}-none`} className="mt-1" disabled={saving || isDisabled} />
|
|
|
+ <Label htmlFor={`${dataType}-none`} className={`flex-1 ${isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'}`}>
|
|
|
<div className="flex items-center gap-2 mb-1">
|
|
|
<Ban className="w-4 h-4 text-red-400" />
|
|
|
<span className="text-white font-medium">No Access</span>
|
|
|
@@ -246,18 +247,21 @@ export function DataAccessSettings({
|
|
|
|
|
|
{/* Policy Settings */}
|
|
|
<div className="space-y-6">
|
|
|
- {/* Products Access */}
|
|
|
+ {/* Products Access - Always enabled, store owners cannot change this */}
|
|
|
<div className="p-4 bg-slate-700/50 rounded-lg border border-slate-600">
|
|
|
<div className="flex items-center gap-2 mb-2">
|
|
|
<h4 className="text-white font-medium">Product Data</h4>
|
|
|
<Badge variant="outline" className="text-xs border-blue-500 text-blue-400">
|
|
|
Public Data
|
|
|
</Badge>
|
|
|
+ <Badge variant="outline" className="text-xs border-slate-500 text-slate-400">
|
|
|
+ Required
|
|
|
+ </Badge>
|
|
|
</div>
|
|
|
<p className="text-sm text-slate-400 mb-3">
|
|
|
- Product information (names, prices, descriptions, stock levels)
|
|
|
+ Product information (names, prices, descriptions, stock levels). This setting is managed by the system and cannot be changed.
|
|
|
</p>
|
|
|
- {renderPolicyOptions('products', 'products_access_policy', false)}
|
|
|
+ {renderPolicyOptions('products', 'products_access_policy', false, true)}
|
|
|
</div>
|
|
|
|
|
|
{/* Customers Access - Hidden when VITE_HIDE_CUSTOMERS_ACCESS_SETTINGS is true */}
|