mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: add admin guard to groups (#4069)
Adds an admin guard to groups: It is an admin feature and should be guarded on the UI the same way other admin features are.
This commit is contained in:
		
							parent
							
								
									bd45a268ce
								
							
						
					
					
						commit
						40a4451818
					
				@ -1,9 +1,20 @@
 | 
				
			|||||||
 | 
					import { AdminAlert } from 'component/common/AdminAlert/AdminAlert';
 | 
				
			||||||
import { GroupsList } from './GroupsList/GroupsList';
 | 
					import { GroupsList } from './GroupsList/GroupsList';
 | 
				
			||||||
 | 
					import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
 | 
				
			||||||
 | 
					import { useContext } from 'react';
 | 
				
			||||||
 | 
					import AccessContext from 'contexts/AccessContext';
 | 
				
			||||||
 | 
					import { ADMIN } from '@server/types/permissions';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const GroupsAdmin = () => {
 | 
					export const GroupsAdmin = () => {
 | 
				
			||||||
 | 
					    const { hasAccess } = useContext(AccessContext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <div>
 | 
					        <div>
 | 
				
			||||||
            <GroupsList />
 | 
					            <ConditionallyRender
 | 
				
			||||||
 | 
					                condition={hasAccess(ADMIN)}
 | 
				
			||||||
 | 
					                show={<GroupsList />}
 | 
				
			||||||
 | 
					                elseShow={<AdminAlert />}
 | 
				
			||||||
 | 
					            />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user