Skip to content

Commit

Permalink
Fixed user_id quick col has a ihp_user_id() default value, even when …
Browse files Browse the repository at this point in the history
…RLS is not used
  • Loading branch information
mpscholten committed Oct 18, 2022
1 parent 67ac12c commit 6115607
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions IHP/IDE/SchemaDesigner/View/Layout.hs
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,12 @@ suggestedColumnsSection tableName indexAndColumns = unless isUsersTable [hsx|
<input type="hidden" name="columnType" value="UUID"/>
<input type="hidden" name="primaryKey" value={inputValue False}/>
<input type="hidden" name="isArray" value={inputValue False}/>
<input type="hidden" name="defaultValue" value="ihp_user_id()"/>
<input type="hidden" name="defaultValue" value={if usesRLS then "ihp_user_id()" :: Text else ""}/>
<input type="hidden" name="allowNull" value={inputValue False}/>
<input type="hidden" name="isUnique" value={inputValue False}/>
<input type="hidden" name="isReference" value={inputValue True}/>
<input type="hidden" name="referenceTable" value="users"/>
<input type="hidden" name="autoPolicy" value={inputValue True}/>
<input type="hidden" name="autoPolicy" value={inputValue usesRLS}/>

<button type="submit" class="btn btn-suggested-table">
<table class="table table-sm mb-0">
Expand All @@ -368,6 +368,10 @@ suggestedColumnsSection tableName indexAndColumns = unless isUsersTable [hsx|
</form>
|]

-- TODO: this should be set to True if the Schema.sql contains any RLS related code
usesRLS :: Bool
usesRLS = False


renderColumn :: Column -> Int -> Text -> [Statement] -> Html
renderColumn Column { name, columnType, defaultValue, notNull, isUnique } id tableName statements = [hsx|
Expand Down

0 comments on commit 6115607

Please sign in to comment.