@@ -39,12 +39,15 @@ export default function TeamSettingsPage() {
39
39
if ( ! org ?. id ) {
40
40
throw new Error ( "no organization selected" ) ;
41
41
}
42
+ if ( ! org . isOwner ) {
43
+ throw new Error ( "no organization settings change permission" ) ;
44
+ }
42
45
updateTeamSettings . mutate ( {
43
46
...settings ,
44
47
...newSettings ,
45
48
} ) ;
46
49
} ,
47
- [ updateTeamSettings , org ?. id , settings ] ,
50
+ [ updateTeamSettings , org ?. id , org ?. isOwner , settings ] ,
48
51
) ;
49
52
50
53
const close = ( ) => setModal ( false ) ;
@@ -60,6 +63,9 @@ export default function TeamSettingsPage() {
60
63
61
64
const updateTeamInformation = useCallback (
62
65
async ( e : React . FormEvent ) => {
66
+ if ( ! org ?. isOwner ) {
67
+ return ;
68
+ }
63
69
e . preventDefault ( ) ;
64
70
65
71
if ( ! orgFormIsValid ) {
@@ -74,7 +80,7 @@ export default function TeamSettingsPage() {
74
80
console . error ( error ) ;
75
81
}
76
82
} ,
77
- [ orgFormIsValid , updateOrg , teamName ] ,
83
+ [ orgFormIsValid , updateOrg , teamName , org ] ,
78
84
) ;
79
85
80
86
const deleteTeam = useCallback ( async ( ) => {
@@ -117,24 +123,36 @@ export default function TeamSettingsPage() {
117
123
value = { teamName }
118
124
error = { teamNameError . message }
119
125
onChange = { setTeamName }
126
+ disabled = { ! org ?. isOwner }
120
127
onBlur = { teamNameError . onBlur }
121
128
/>
122
129
123
- < Button className = "mt-4" htmlType = "submit" disabled = { org ?. name === teamName || ! orgFormIsValid } >
124
- Update Organization
125
- </ Button >
130
+ { org ?. isOwner && (
131
+ < Button className = "mt-4" htmlType = "submit" disabled = { org ?. name === teamName || ! orgFormIsValid } >
132
+ Update Organization
133
+ </ Button >
134
+ ) }
126
135
127
136
< Heading2 className = "pt-12" > Collaboration & Sharing </ Heading2 >
128
137
< CheckboxInputField
129
138
label = "Workspace Sharing"
130
139
hint = "Allow workspaces created within an Organization to share the workspace with any authenticated user."
131
140
checked = { ! settings ?. workspaceSharingDisabled }
132
141
onChange = { ( checked ) => handleUpdateTeamSettings ( { workspaceSharingDisabled : ! checked } ) }
133
- disabled = { isLoading }
142
+ disabled = { isLoading || ! org ?. isOwner }
143
+ />
144
+
145
+ < Heading2 className = "pt-12" > Workspace Settings</ Heading2 >
146
+ < TextInputField
147
+ label = "Default Image"
148
+ hint = "Default image of organization workspaces"
149
+ value = { settings ?. defaultWorkspaceImage ?? "" }
150
+ onChange = { ( value ) => handleUpdateTeamSettings ( { defaultWorkspaceImage : value } ) }
151
+ disabled = { isLoading || ! org ?. isOwner }
134
152
/>
135
153
</ form >
136
154
137
- { user ?. organizationId !== org ?. id && (
155
+ { user ?. organizationId !== org ?. id && org ?. isOwner && (
138
156
< >
139
157
< Heading2 className = "pt-12" > Delete Organization</ Heading2 >
140
158
< Subheading className = "pb-4 max-w-2xl" >
0 commit comments