public static void checkProjectAdmin ( UserSession userSession , String organizationUuid , Optional < ProjectId > projectId ) { userSession . checkLoggedIn ( ) ; if ( userSession . hasPermission ( OrganizationPermission . ADMINISTER , organizationUuid ) ) { return ; } if ( projectId . isPresent ( ) ) { userSession . checkComponentUuidPermission ( UserRole . ADMIN , projectId . get ( ) . getUuid ( ) ) ; } else { throw insufficientPrivilegesException ( ) ; } }
Checks that user is administrator of the specified project or of the specified organization if project is not defined .