。
What were you thinking, letting the imperial army into the castle?
Literal
Imperial-army [target-に] entering-castle [object-を] permit [quote-とは], what kind-of thinking [copula-だ]?
Historical drama dialogue. 官軍 ('imperial army' — the official government forces, especially in the context of the Meiji Restoration). 入城 ('entering a castle') is a formal/historical compound. 了見 ('intention, idea, mindset') is a slightly old-fashioned word used here for 'what were you thinking?!' — a rhetorical reproach. とは marks the action as the subject of indignation. A rebuke delivered by a samurai lord.