File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
phpmyfaq/admin/assets/src/user Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ const setUserData = async (userId) => {
50
50
if ( userData . is_superadmin ) {
51
51
const superAdmin = document . getElementById ( 'is_superadmin' ) ;
52
52
superAdmin . setAttribute ( 'checked' , 'checked' ) ;
53
+ document . querySelectorAll ( '.permission' ) . forEach ( ( checkbox ) => {
54
+ checkbox . setAttribute ( 'disabled' , '' ) ;
55
+ } )
53
56
}
54
57
55
58
if ( userData . twofactor_enabled === '1' ) {
@@ -121,7 +124,22 @@ export const handleUsers = async () => {
121
124
const addUserError = document . getElementById ( 'pmf-add-user-error-message' ) ;
122
125
const passwordToggle = document . getElementById ( 'add_user_automatic_password' ) ;
123
126
const passwordInputs = document . getElementById ( 'add_user_show_password_inputs' ) ;
127
+ const isSuperAdmin = document . getElementById ( 'is_superadmin' ) ;
124
128
129
+ if ( isSuperAdmin ) {
130
+ isSuperAdmin . addEventListener ( 'click' , ( ) => {
131
+ if ( isSuperAdmin . checked ) {
132
+ document . querySelectorAll ( '.permission' ) . forEach ( ( checkbox ) => {
133
+ checkbox . setAttribute ( 'disabled' , '' ) ;
134
+ } ) ;
135
+ } else {
136
+ document . querySelectorAll ( '.permission' ) . forEach ( ( checkbox ) => {
137
+ checkbox . removeAttribute ( 'disabled' ) ;
138
+ } ) ;
139
+ }
140
+ } )
141
+ }
142
+
125
143
if ( passwordToggle ) {
126
144
passwordToggle . addEventListener ( 'click' , ( ) => {
127
145
passwordInputs . classList . toggle ( 'd-none' ) ;
You can’t perform that action at this time.
0 commit comments