@@ -127,10 +127,10 @@ func Create(ctx context.Context, args GenerateArgs) error {
127127 return err
128128 }
129129 }
130- if err := api .DropSelectPermissions (ctx , args .Views [i ], args .Config .Source .Name , "user" ); err != nil {
130+ if err := api .DropSelectPermissions (ctx , args .Views [i ], args .Config .Source .Name , args . Config . UnauthorizedRole ); err != nil {
131131 log .Warn ().Err (err ).Msg ("" )
132132 }
133- if err := api .CreateSelectPermissions (ctx , args .Views [i ], args .Config .Source .Name , "user" , Permission {
133+ if err := api .CreateSelectPermissions (ctx , args .Views [i ], args .Config .Source .Name , args . Config . UnauthorizedRole , Permission {
134134 Limit : args .Config .RowsLimit ,
135135 AllowAggs : args .Config .EnableAggregations ,
136136 Columns : Columns {"*" },
@@ -197,7 +197,7 @@ func generateOne(hasura config.Hasura, schema string, model interface{}) (table,
197197 t .HasuraSchema = newMetadataTable (t .Name , t .Schema )
198198 t .Columns = getColumns (typ )
199199
200- t .HasuraSchema .SelectPermissions = append (t .HasuraSchema .SelectPermissions , formatSelectPermissions (hasura .RowsLimit , hasura .EnableAggregations , t .Columns ... ))
200+ t .HasuraSchema .SelectPermissions = append (t .HasuraSchema .SelectPermissions , formatSelectPermissions (hasura .RowsLimit , hasura .EnableAggregations , hasura . UnauthorizedRole , t .Columns ... ))
201201
202202 if err := getRelationships (& t .HasuraSchema , t .Name , typ ); err != nil {
203203 return t , err
@@ -273,12 +273,12 @@ func getRelationships(t *Table, name string, typ reflect.Type) error {
273273 return nil
274274}
275275
276- func formatSelectPermissions (limit uint64 , allowAggs bool , columns ... string ) SelectPermission {
276+ func formatSelectPermissions (limit uint64 , allowAggs bool , role string , columns ... string ) SelectPermission {
277277 if limit == 0 {
278278 limit = 10
279279 }
280280 return SelectPermission {
281- Role : "user" ,
281+ Role : role ,
282282 Permission : Permission {
283283 Columns : columns ,
284284 Filter : map [string ]interface {}{},
0 commit comments