refactor: remove legacy permission system, use only feature-overrides
AdminPanel.jsx: - Removed ai_enabled, ai_limit_day, export_enabled UI - Kept only role selection (Admin/User) - Added link to Feature-Overrides page - Simplified perms state to only role - Changed display to show tier and email AdminUserRestrictionsPage.jsx: - Removed legacy system warning - Clean interface, no confusion Result: - ONE consistent permission system (feature-overrides) - Clear separation: role in AdminPanel, limits in Feature-Overrides - No data migration needed (no old users exist) - System ready for production Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b1a1925360
commit
3eae7eb43f
|
|
@ -143,9 +143,6 @@ function EmailEditor({ profileId, currentEmail, onSaved }) {
|
|||
function ProfileCard({ profile, currentId, onRefresh }) {
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const [perms, setPerms] = useState({
|
||||
ai_enabled: profile.ai_enabled ?? 1,
|
||||
ai_limit_day: profile.ai_limit_day || '',
|
||||
export_enabled: profile.export_enabled ?? 1,
|
||||
role: profile.role || 'user',
|
||||
})
|
||||
const [saving, setSaving] = useState(false)
|
||||
|
|
@ -157,9 +154,6 @@ function ProfileCard({ profile, currentId, onRefresh }) {
|
|||
setSaving(true)
|
||||
try {
|
||||
await api.adminSetPermissions(profile.id, {
|
||||
ai_enabled: perms.ai_enabled,
|
||||
ai_limit_day: perms.ai_limit_day ? parseInt(perms.ai_limit_day) : null,
|
||||
export_enabled: perms.export_enabled,
|
||||
role: perms.role,
|
||||
})
|
||||
await onRefresh()
|
||||
|
|
@ -196,9 +190,8 @@ function ProfileCard({ profile, currentId, onRefresh }) {
|
|||
{isSelf && <span style={{fontSize:10,color:'var(--text3)'}}>Du</span>}
|
||||
</div>
|
||||
<div style={{fontSize:11,color:'var(--text3)'}}>
|
||||
KI: {profile.ai_enabled?`✓${profile.ai_limit_day?` (max ${profile.ai_limit_day}/Tag)`:''}` : '✗'} ·
|
||||
Export: {profile.export_enabled?'✓':'✗'} ·
|
||||
Calls heute: {profile.ai_calls_today||0}
|
||||
Tier: {profile.tier || 'free'} ·
|
||||
Email: {profile.email || 'nicht gesetzt'}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{display:'flex',gap:6}}>
|
||||
|
|
@ -233,23 +226,19 @@ function ProfileCard({ profile, currentId, onRefresh }) {
|
|||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Toggle value={!!perms.ai_enabled} onChange={v=>setPerms(p=>({...p,ai_enabled:v?1:0}))} label="KI-Analysen erlaubt"/>
|
||||
{!!perms.ai_enabled && (
|
||||
<div className="form-row" style={{paddingTop:6}}>
|
||||
<label className="form-label" style={{fontSize:12}}>Max. KI-Calls/Tag</label>
|
||||
<input type="number" className="form-input" style={{width:70}} min={1} max={100}
|
||||
placeholder="∞" value={perms.ai_limit_day}
|
||||
onChange={e=>setPerms(p=>({...p,ai_limit_day:e.target.value}))}/>
|
||||
<span className="form-unit" style={{fontSize:11}}>/Tag</span>
|
||||
</div>
|
||||
)}
|
||||
<Toggle value={!!perms.export_enabled} onChange={v=>setPerms(p=>({...p,export_enabled:v?1:0}))} label="Daten-Export erlaubt"/>
|
||||
|
||||
<button className="btn btn-primary btn-full" style={{marginTop:10}} onClick={savePerms} disabled={saving}>
|
||||
{saving?'Speichern…':'Berechtigungen speichern'}
|
||||
<button className="btn btn-primary btn-full" style={{marginTop:8}} onClick={savePerms} disabled={saving}>
|
||||
{saving?'Speichern…':'Rolle speichern'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Feature-Overrides */}
|
||||
<div style={{marginBottom:12,padding:10,background:'var(--accent-light)',borderRadius:6,fontSize:12}}>
|
||||
<strong>Feature-Limits:</strong> Nutze die neue{' '}
|
||||
<Link to="/admin/user-restrictions" style={{color:'var(--accent-dark)',fontWeight:600}}>
|
||||
User Feature-Overrides
|
||||
</Link>{' '}
|
||||
Seite um individuelle Limits zu setzen.
|
||||
</div>
|
||||
|
||||
{/* Email */}
|
||||
<div style={{marginTop:12,paddingTop:12,borderTop:'1px solid var(--border)'}}>
|
||||
|
|
|
|||
|
|
@ -252,24 +252,6 @@ export default function AdminUserRestrictionsPage() {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{/* Legacy System Warning */}
|
||||
<div style={{
|
||||
padding: 12, background: '#FFF3CD', borderRadius: 8,
|
||||
marginBottom: 16, fontSize: 12, color: '#856404',
|
||||
display: 'flex', gap: 8, alignItems: 'flex-start',
|
||||
border: '1px solid #FFE69C'
|
||||
}}>
|
||||
<AlertCircle size={16} style={{ marginTop: 2, flexShrink: 0 }} />
|
||||
<div>
|
||||
<strong>⚠️ Legacy-System aktiv:</strong> In der Benutzerverwaltung existiert noch das alte Berechtigungssystem
|
||||
("KI-Analysen erlaubt", "Max. KI-Calls/Tag", "Daten-Export erlaubt").
|
||||
Diese Einstellungen können mit den neuen Feature-Overrides kollidieren.
|
||||
<strong> Das neue Feature-Override-System hat Vorrang.</strong>
|
||||
<br/><br/>
|
||||
<strong>Empfehlung:</strong> Verwende nur noch Feature-Overrides. Das alte System wird in einer zukünftigen Version entfernt.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Messages */}
|
||||
{error && (
|
||||
<div style={{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user