🐛 Fix new realm owner missing permissions

This commit is contained in:
LittleSheep 2024-05-05 22:03:51 +08:00
parent ec911b828e
commit 35f9580499
3 changed files with 35 additions and 32 deletions

View File

@ -838,50 +838,50 @@ false Zulu
<Replication>1</Replication> <Replication>1</Replication>
<SuperRole>1</SuperRole> <SuperRole>1</SuperRole>
</role> </role>
<role id="8" parent="1" name="pg_checkpoint"> <role id="8" parent="1" name="pg_database_owner">
<ObjectId>4544</ObjectId>
</role>
<role id="9" parent="1" name="pg_create_subscription">
<ObjectId>6304</ObjectId>
</role>
<role id="10" parent="1" name="pg_database_owner">
<ObjectId>6171</ObjectId> <ObjectId>6171</ObjectId>
</role> </role>
<role id="11" parent="1" name="pg_execute_server_program"> <role id="9" parent="1" name="pg_read_all_data">
<ObjectId>4571</ObjectId> <ObjectId>6181</ObjectId>
</role> </role>
<role id="12" parent="1" name="pg_monitor"> <role id="10" parent="1" name="pg_write_all_data">
<ObjectId>6182</ObjectId>
</role>
<role id="11" parent="1" name="pg_monitor">
<ObjectId>3373</ObjectId> <ObjectId>3373</ObjectId>
<RoleGrants>3374 <RoleGrants>3374
3375 3375
3377</RoleGrants> 3377</RoleGrants>
</role> </role>
<role id="13" parent="1" name="pg_read_all_data"> <role id="12" parent="1" name="pg_read_all_settings">
<ObjectId>6181</ObjectId>
</role>
<role id="14" parent="1" name="pg_read_all_settings">
<ObjectId>3374</ObjectId> <ObjectId>3374</ObjectId>
</role> </role>
<role id="15" parent="1" name="pg_read_all_stats"> <role id="13" parent="1" name="pg_read_all_stats">
<ObjectId>3375</ObjectId> <ObjectId>3375</ObjectId>
</role> </role>
<role id="16" parent="1" name="pg_read_server_files"> <role id="14" parent="1" name="pg_stat_scan_tables">
<ObjectId>4569</ObjectId>
</role>
<role id="17" parent="1" name="pg_signal_backend">
<ObjectId>4200</ObjectId>
</role>
<role id="18" parent="1" name="pg_stat_scan_tables">
<ObjectId>3377</ObjectId> <ObjectId>3377</ObjectId>
</role> </role>
<role id="19" parent="1" name="pg_use_reserved_connections"> <role id="15" parent="1" name="pg_read_server_files">
<ObjectId>4569</ObjectId>
</role>
<role id="16" parent="1" name="pg_write_server_files">
<ObjectId>4570</ObjectId>
</role>
<role id="17" parent="1" name="pg_execute_server_program">
<ObjectId>4571</ObjectId>
</role>
<role id="18" parent="1" name="pg_signal_backend">
<ObjectId>4200</ObjectId>
</role>
<role id="19" parent="1" name="pg_checkpoint">
<ObjectId>4544</ObjectId>
</role>
<role id="20" parent="1" name="pg_use_reserved_connections">
<ObjectId>4550</ObjectId> <ObjectId>4550</ObjectId>
</role> </role>
<role id="20" parent="1" name="pg_write_all_data"> <role id="21" parent="1" name="pg_create_subscription">
<ObjectId>6182</ObjectId> <ObjectId>6304</ObjectId>
</role>
<role id="21" parent="1" name="pg_write_server_files">
<ObjectId>4570</ObjectId>
</role> </role>
<role id="22" parent="1" name="postgres"> <role id="22" parent="1" name="postgres">
<CanLogin>1</CanLogin> <CanLogin>1</CanLogin>

9
.idea/workspace.xml generated
View File

@ -4,8 +4,10 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Bug fixes on realm missing member on creation"> <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Dumb man make dumb mistake again">
<change beforePath="$PROJECT_DIR$/pkg/server/realms_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/server/realms_api.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/dataSources/74bcf3ef-a2b9-435b-b9e5-f32902a33b25.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/74bcf3ef-a2b9-435b-b9e5-f32902a33b25.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/services/realms.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/services/realms.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -146,7 +148,8 @@
<MESSAGE value=":bug: Bug fixes on forgot add realm members for account" /> <MESSAGE value=":bug: Bug fixes on forgot add realm members for account" />
<MESSAGE value=":bug: Bug fix on missing id in realm" /> <MESSAGE value=":bug: Bug fix on missing id in realm" />
<MESSAGE value=":bug: Bug fixes on realm missing member on creation" /> <MESSAGE value=":bug: Bug fixes on realm missing member on creation" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Bug fixes on realm missing member on creation" /> <MESSAGE value=":bug: Dumb man make dumb mistake again" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Dumb man make dumb mistake again" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -59,7 +59,7 @@ func GetRealmWithAlias(alias string) (models.Realm, error) {
func NewRealm(realm models.Realm, user models.Account) (models.Realm, error) { func NewRealm(realm models.Realm, user models.Account) (models.Realm, error) {
realm.Members = []models.RealmMember{ realm.Members = []models.RealmMember{
{AccountID: user.ID}, {AccountID: user.ID, PowerLevel: 100},
} }
err := database.C.Save(&realm).Error err := database.C.Save(&realm).Error